Home: Other Programming Languages: PHP:
uploading an image


May 1, 2006, 10:22 PM

Views: 45663
uploading an image


Im trying to upload an image using php.Im getting the file from a form and on submitting the form it calls a php file.Th file is


// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir =
$uploadfile = $uploaddir . basename

echo '<pre>';
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
else {
echo "Possible file upload attack!\n";

echo 'Here is some more debugging info:';



When i try to upload it raises a warinin message that the php file does not exists.

Help me to sort out the problem


May 3, 2006, 8:03 AM

Views: 45660
Re: [tolearn] uploading an image

Should be an error in your form (or filename). Make sure the file exists, it might have something to do with case-sensitivity or aliasses.
Don't reinvent the wheel, use it, abuse it or hack it.