Page 1 of 1
uploaded_file variable issue?
Posted: Thu Jun 24, 2010 9:36 am
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
Re: uploaded_file variable issue?
Posted: Thu Jun 24, 2010 10:07 am
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.
Re: uploaded_file variable issue?
Posted: Thu Jun 24, 2010 2:10 pm
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.
Re: uploaded_file variable issue?
Posted: Fri Jun 25, 2010 12:56 am
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.
Re: uploaded_file variable issue?
Posted: Fri Jun 25, 2010 7:37 am
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.