lucix Posted July 26, 2010 Share Posted July 26, 2010 Hi, I have an php upload script to simply upload files to my website but I get an error uploading files constantly. Here is the script: <?php $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> And this is the error I get: Notice: Undefined index: uploadedfile in C:\wamp\www\upload.php on line 6 The file has been uploaded Can someone help me fix it? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/208938-php-upload-script-error/ Share on other sites More sharing options...
AbraCadaver Posted July 26, 2010 Share Posted July 26, 2010 That's not an upload error but an error in your echo. You are using $_FILES['uploaded']['name'] at first with no error. Then in your echo you use $_FILES['uploadedfile']['name']. One of these is not like the other. Quote Link to comment https://forums.phpfreaks.com/topic/208938-php-upload-script-error/#findComment-1091396 Share on other sites More sharing options...
lucix Posted July 27, 2010 Author Share Posted July 27, 2010 Thanks for your reply. How can I fix it though? Quote Link to comment https://forums.phpfreaks.com/topic/208938-php-upload-script-error/#findComment-1091533 Share on other sites More sharing options...
jcbones Posted July 27, 2010 Share Posted July 27, 2010 //Change $_FILES['uploadedfile']['name'] //To $_FILES['uploaded']['name'] Quote Link to comment https://forums.phpfreaks.com/topic/208938-php-upload-script-error/#findComment-1091535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.