Reputation: 1127
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
Upvotes: 0
Views: 54
Reputation: 74217
Actually your file needs to be named most probably.
Try
<input type="file" name="file">
or whatever is set in your up.php
file
Upvotes: 1
Reputation: 70863
You need <form method="post" ...>
for the form to work.
And the file input should have a name attribute.
Upvotes: 0