0

I have a very simple script:

<!doctype html> <html> <head> <meta charset="utf-8"> </head> <body> <!-- this is up.php --> <form action="up.php" method="post" enctype="multipart/form-data"> <input type="file"> <input type="submit"> </form> <?php print_r($_FILES); ?> </body> </html> 

When I select a file and I click on "Submit" the page is istantly reloaded and nothing happens.
I'm trying with this little script because in a more complex page with other fields everything works well except for the file form. I mean, the database is filled with all the informations provided by my form, but images are not uploaded.

The problem is that the page neither try to upload them, I mean, it should upload them (see the percentage on bottom of page) and then pass it to PHP.
In my case instead the page is istantly submitted and reloaded without the attempt of load pictures.

I have other scripts on my server that upload images, and them works.

Why this one does not work? Thanks.

Edit: live demo here: http://allise.net/up.php

7
  • Got an Array() output. Try this <input type="file[]"> Commented Aug 8, 2013 at 21:30
  • Also try naming your submit button <input type="submit" name="submit" value="UPLOAD"> Commented Aug 8, 2013 at 21:31
  • 'type="file[]' breaks the input field... Commented Aug 8, 2013 at 21:32
  • Actually your file needs to be named most probably. Try <input type="file" name="file"> or whatever is set in your up.php file. Commented Aug 8, 2013 at 21:32
  • Yeah I saw that. Try my suggestion above. Commented Aug 8, 2013 at 21:33

2 Answers 2

1

Actually your file needs to be named most probably.

Try

<input type="file" name="file"> 

or whatever is set in your up.php file

Sign up to request clarification or add additional context in comments.

Comments

0

You need <form method="post" ...> for the form to work.

And the file input should have a name attribute.

1 Comment

Sorry I've updated the script, even with method post set it does not work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.