Hi all,

I'm trying to upload files to a PM G4 (OS X 10.3.9) through a php webpage.

I have my form and it's fine, then the getfile.php page has the following script:

<?php

$uploaddir = '/Library/WebServer/Documents/mysite/Images/Pictures/';
$uploadfile = $uploaddir . basename($_FILES['uploadedFile']['name']);

echo '

';
if (move_uploaded_file($_FILES['uploadedFile']['tmp_name'], $uploadFile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}s

echo 'Here is some more debugging info:';

print_r($_FILES);

print "

";

?>

and I get the following error:

Possible file upload attack!
Here is some more debugging info:Array
(
[uploadedFile] => Array
(
[name] => test.bmp
[type] => image/x-bmp
[tmp_name] => /var/tmp/phplqhsuj
[error] => 0
[size] => 230454
)

)

According to PHP manual:

UPLOAD_ERR_OK

Value: 0; There is no error, the file uploaded with success.

And yet no file is uploaded to the dir specified.
I have set permissions to 777 for the /tmp/ folder (which is the upload folder set in php.ini) and on the /Images folder.

Has anyone come across something similar before?

Thanks for your help.

PM G4 (Gigabit E) - 400Mhz, 756MB RAM, HD 80GB 7200rpm - iPod Nano Mac OS X (10.3.9) Server version of OS

    It looks like you're giving it an invalid path; "$uploadFile" isn't the same as "$uploadfile".

      Thanks installer, I should have spotted that myself!

      It is now working. In case someone encounters the same issue:

      I also had to change per missions on /var/tmp/ to chmod 777 (Was 700) and change group to www (Was wheel).

        Write a Reply...