By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,408 Members | 1,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,408 IT Pros & Developers. It's quick & easy.

moving pictures

P: n/a
I am using this code to move one picture to my server.
Part of the code:
if ($pic_size > 0) {
mkdir("$dir/$date", 0777);
$upload_file = system("/bin/cp $pic $dir/$date/big$fname", $retval);
$convert = system("convert -scale 320x240 $pic
$dir/$date/small$fname", $ret);
$convert = system("convert -scale 160x120 $pic
$dir/$date/thumbnail$fname", $ret);

if ($retval==0) {
"

The $pic I take from the form.
How can I move whole folder instead of one file?

Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Well, you seem to be doing everything with system calls instead of PHP
functions. So you can use some system call to move an entire folder,
or you can use the PHP directory functions:

http://us4.php.net/manual/en/ref.dir.php

You can use opendir to open the directory, and readdir to scan through
each file. See the documentation for readdir. Make sure to use is_dir
to check if the file is a file or a directory before moving it (you
probably only want to move files). Then you can use copy to copy each
file you find. If you want to move instead of copy, just use unlink to
delete each source file after the copy.
Voila.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.