uploaded_file variable issue?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scooke6
Forum Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:34 am

uploaded_file variable issue?

Post by scooke6 »

I have created a form that will email the information in the form with the file attached. I am getting this error

PHP Notice: Undefined index: uploaded_file in C:\Inetpub\wwwroot\STEG2\application.php on line 1844
PHP Notice: Undefined index: uploaded_file in C:\Inetpub\wwwroot\STEG2\application.php on line 1855
PHP Fatal error: Call to undefined function IsInjected() in C:\Inetpub\wwwroot\STEG2\application.php on line 1869

When I run this code byitself in a simpler form it works great.
any help?

here is the file in question.
http://dl.dropbox.com/u/2857979/application.php
Thanks in advance
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Re: uploaded_file variable issue?

Post by thiscatis »

Do you call IsInjected() before you defined it?
Define your functions at the top of the php page or in an external file and include them.
scooke6
Forum Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:34 am

Re: uploaded_file variable issue?

Post by scooke6 »

i've moved some code around and I am still getting this error about uploading the file.

PHP Notice: Undefined index: uploaded_file in C:\Inetpub\wwwroot\STEG2\application.php on line 1024
PHP Notice: Undefined index: uploaded_file in C:\Inetpub\wwwroot\STEG2\application.php on line 1035

Here is the current full doc. http://dl.dropbox.com/u/2857979/application.php
here is the section of code in question

Code: Select all

$name_of_uploaded_file =  basename($_FILES['uploaded_file']['name']);                                     //line 1024
	//get the file extension of the file
	$type_of_uploaded_file = substr($name_of_uploaded_file, 
							strrpos($name_of_uploaded_file, '.') + 1);
		$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;                           //line 1035
It's just very confusing why PHP thinks this variable is not defined.

Code: Select all

<label for='uploaded_file'>Select A File To Upload:</label> <br>     //line 881

<input type="file" name="uploaded_file" id="uploaded_file">         //line 883
This is my code for the input. so I htink i'm doing this correctly.
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: uploaded_file variable issue?

Post by cpetercarter »

Maybe the file is not uploading. A possible reason is that you have not included an enctype="multipart/form-data" attribute in the form tag.
scooke6
Forum Newbie
Posts: 3
Joined: Thu Jun 24, 2010 9:34 am

Re: uploaded_file variable issue?

Post by scooke6 »

That helps ALOT!! thank you. I'm able to get the code to work but now i'm having another issue where it's not saving to where I want it to go. i'll post about that issue if I can't figure it out.
Post Reply