0

Ok guys, I've kind of got this file half way working, but
I get this message: Notice: Undefined index: uploadedfile on line whatever.

along with this: The file has been uploaded. which is the good part.

But I don't understand why I always get those undefined errors.

$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.";  }  }

The error is on line 18, just incase that matters

Thanks
Dan

Edited by dan_t: added error line

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by dan_t
0

You seem to be using $_FILES['uploaded']['tmp_name'] and then you use $_FILES['uploadedfile']['tmp_name'] near the end of this code piece. Maybe you intended to use 'uploaded'.

0

You seem to be using $_FILES['uploaded']['tmp_name'] and then you use $_FILES['uploadedfile']['tmp_name'] near the end of this code piece. Maybe you intended to use 'uploaded'.

You did it!
That fixed it, your a genius.
I never noticed it. I do tend to do that a bit. I need to take much better notes.
Thanks
Dan

Edited by dan_t: misspelling

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.