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

Procedural to OOP
ohn Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO pri

Problem with Sending Mail by PHP
hello all,
I m new to php, can u plz provide me the code to send mail by php having CAPTC

CURL question
i am wondering if it's possible to use multi curl with login something like

login once to web

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

Ajax not working on IE 6 for Windows CE
I've created a webpage which uses the classis Ajax in following format:view plaincopy to clipboardpr

Hardcopy printing is to wide
I want to make a hardcopy at runtime of my active form like this

help need on ob_start()
Hi

I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo

include
Hi I have this way of licensing my PHP application, and I want to know if you guys can answer some q

ASP.NET 2.0 - Enter Key - Default Submit Button
Hi,One of the most annoying things in developing web pages is handling the "Enter key" for form subm

generate seo frienly url from a text like wordpress
Convert: "åäö" to "aao", "space" to "-", "!?&q

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