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">
<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

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

Need help with cin setw
I made a program here is my code:

#include
#include
#i

Parse Error with doctype
I'm getting a parse error with this simple code. I don't get it. It worked one time then when I relo

Multidimensional array problems in $_POST
I'm having trouble with a three-dimensional $_POST array. It starts as a two-dimensional array on th

private constructor
Hello,

Can we create a constructor as private? If yes, what is the use of it? If no, why can'

moving mouse to display image coordinates
I have an existing MFC application that shows an image in the main window.
I'd like to be able to

Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a

Find current logon time
Hi,
in my sql script i want to query and find out the logon time of the current session.
<

Inserting multiple records from single form
I've found a number of threads that deal with this issue, but I'm new to php and coding language so

imap: how to save a copy of sent emails to sent elements
Hello my friends,

I am writing an online emailing application with inbox outbox/sent elements

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