Page 1 of 1

Exec code with images?

Posted: Fri Mar 12, 2004 11:06 am
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?

Re: Exec code with images?

Posted: Fri Mar 12, 2004 11:13 am
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.