[PHP] Error with : move_uploaded_file
I've a bug with my upload page in php.
It's work fine on a Linux Server, but with my mac on Local it doesn't work.
I use :
$tempFile = $ FILES['Filedata']['tmpname'];
$targetPath = $ SERVER['DOCUMENTROOT'] . $_GET['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
if(is uploadedfile($tempFile)){
if(move uploadedfile($tempFile,$targetFile)){
echo 1;
}else{
echo 0;
}
}
________________________________________________________________________________ __
This is the error returned :
Warning: move uploaded_file(/Library/WebServer/Documents/~KicheTof/Gallerie/admin/upload/img/i mgtemp/tof.jpg) [ function.move-uploaded-file]: failed to open stream: No such file or directory in /Users/KicheTof/Sites/Gallerie/admin/upload/upload.php on line 11
Warning: move uploadedfile() [ function.move-uploaded-file]: Unable to move '/private/var/tmp/php/php3q2s1h' to '/Library/WebServer/Documents/~KicheTof/Gallerie/admin/upload/img/img_temp/tof. jpg' in /Users/KicheTof/Sites/Gallerie/admin/upload/upload.php on line 11
I tried to set the uploadtmpdir in php.ini but it doesn't change anything
________________________________________________________________________________ __
The CHMOD of the folders :
drwxrwxrwx+ 15 KicheTof staff 510 14 jul 22:17 Sites
drwxrwxrwx 13 KicheTof staff 442 14 jul 18:07 Gallerie
drwxrwxrwx 13 KicheTof staff 442 16 jul 18:13 admin
drwxrwxrwx 16 KicheTof staff 544 16 jul 19:07 upload
drwxrwxrwx 6 KicheTof staff 204 16 jul 18:13 img
drwxrwxrwx 10 KicheTof staff 340 16 jul 18:13 img_temp
________________________________________________________________________________ __
I hope you have the solution! I searched for about 5 hours without success =(
Thank's !
Christophe
MacBook Pro Unibody, Mac OS X (10.5.7), PHP Version 5.2.8
