Form File Upload


Posted on 16th Feb 2014 07:03 pm by admin

I've read through tons of resources and tutorials and as far as I can tell, my code is accurate, but for some reason it's not working...

My HTML Form:
Code: <form action="script.php" name="update" method="post">
Did you know?Explore Trending and Topic pages for more stories like this.
<input type="file" name="update_banner" size="22" /> <br />
<input type="submit" name="update_submit" value="Update Subscription" />
</form>

My Handling Script:

// if there is an update submitted...
if (isset($_POST['update_submit'])) // if the update form has been submitted
{
// if there is a file to upload...
if (isset($_FILES['update_banner']) && !empty($_FILES['update_banner']['name']))
{
// it should give me all the info about that file...
die(print_r($_FILES));
}
else
{
die("No file has been uploaded");
}
}
else
{
die("No upload has been submitted");
}


It should output all the info about that file, but I load the form, select an image from my computer, hit submit, and it tells me there is no file.

Any ideas why?
No comments posted yet

Your Answer:

Login to answer
229 Like 50 Dislike
Previous forums Next forums
Other forums

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

Undefined variables
hi
----------------------------------------------------------------------------------------------

ImageCreate()
When I create an image and add text to it I want my text to be replaced with a PNG image, because th

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

INSERT data problem!
After having an string with apostrophes ', double quotes " or any other special characters, suc

How can i steam a video on my PHP site? (non YouTube)
Basically I have a PHP site and don't want to give page rank to YouTube. I just want to stream a bas

Using system() and bringing back the results
I am aware that you can use system() within PHP to execute system commands, but I was wondering if t

Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a

Error In Syntax
I got this error:

Code: Parse error: syntax error, unexpected '>' in /home/bucket/publ

CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash