[SOLVED] Help with PHP File Uploads
Posted: Thu Feb 10, 2005 9:10 pm
I have been trying to use the php upload script from the PHP.net site at http://www.php.net/manual/en/features.file-upload.php
Here is what I have thus far:
Then on moveuploaded.php I have the following:
I am getting the following error:
Thanks so much for any insight!!!
Here is what I have thus far:
Code: Select all
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="moveuploaded.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>Code: Select all
<?php
$uploadDir = '/myftpinfo/images/';
$uploadFile = $uploadDir . $_FILESї'userfile']ї'name'];
print "<pre>";
if (move_uploaded_file($_FILESї'userfile']ї'tmp_name'], $uploadFile))
{
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
}
else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";
?>I haven't included the myftpinfo details here but I'm using mydomain.com... but I suspect that might be the problem. What should the format for specifying the ftp location be? Is that the issue I have above?Warning: move_uploaded_file(/myftpinfo/images/C22logo.jpg): failed to open stream: No such file or directory in /Library/WebServer/Documents/avocado/moveuploaded.php on line 2
Warning: move_uploaded_file(): Unable to move '/var/tmp/phpVXsYJI' to '/myftpinfo/images/C22logo.jpg' in /Library/WebServer/Documents/avocado/moveuploaded.php on line 2
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => C22logo.jpg
[type] => image/jpeg
[tmp_name] => /var/tmp/phpVXsYJI
[error] => 0
[size] => 12774
)
)
Thanks so much for any insight!!!