Exec code with images?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Exec code with images?

Post by Steveo31 »

The URL I'm lookin at is http://www.phpbuilder.com/columns/willi ... hp3?page=4 and you'll see in the code that it has the following line:

Code: Select all

exec("cp $picture /full/path/to/joesauto/images/$picture_name");
I looked it up on PHP.net and it said that the exec command is for executing internal programs... but what is CP? I didn't see it defined anywhere in the phpbuilder link.

Oh, and just to be sure, the variables all have to be changed to $_POST var's, right?
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Exec code with images?

Post by TheBentinel.com »

Steveo31 wrote:The URL I'm lookin at is http://www.phpbuilder.com/columns/willi ... hp3?page=4 and you'll see in the code that it has the following line:

Code: Select all

exec("cp $picture /full/path/to/joesauto/images/$picture_name");
I looked it up on PHP.net and it said that the exec command is for executing internal programs... but what is CP? I didn't see it defined anywhere in the phpbuilder link.

Oh, and just to be sure, the variables all have to be changed to $_POST var's, right?
"cp" is the unix/linux command to copy a file:

cp sourcefile targetfile # copies source to target

So that command tries to drop out to the O/S and execute the cp command to copy the file.

You're running on a flavor of unix? If not, you'll need to change it to the copy command for whatever O/S you're running.

Not sure how to answer your $_POST question, so I'll leave that to someone else.
Post Reply