dan_t Posted May 8, 2010 Share Posted May 8, 2010 I have run into this more than once, but I never takes notes. I get this error when running my code: Notice: Undefined index: uploadedfile in C:\wamp\www\upload.php on line 19 The file has been uploaded. Is is uploading, but I get the undefined index. here is my code: $uploaded_size =''; $uploaded_type = ""; $uploadedfile = "" ; $target = "c:/wamp/upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is the sizing condition if ($uploaded_size > 350000) { echo "Your file is too large.<br>"; $ok=0; } //This is the file type limit condition if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } if ($uploaded_type =="text/css") { echo "No CSS files<br>"; $ok=0; } if ($uploaded_type =="text/javascript") { echo "No Javascript files<br>"; $ok=0; } if ($ok==0) { Echo "Sorry your file was not uploaded"; } else { 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."; } } How do I get rid of this warning? How can I define or hide it? Thanks Dan Link to comment https://forums.phpfreaks.com/topic/201126-undefined-index/ Share on other sites More sharing options...
kenrbnsn Posted May 8, 2010 Share Posted May 8, 2010 You're getting this warning probably because of this: <?php $_FILES['uploadedfile']['name'] ?> The index in the $_FILES array is probably 'uploaded', not 'uploadedfile'. Ken Link to comment https://forums.phpfreaks.com/topic/201126-undefined-index/#findComment-1055202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.