tags:

views:

52

answers:

2

Hello, I have a trouble with file-uploding. Here is my part of the form:

<input type="file" name="image_file" />
<input type="submit" name="add_new" value="Upload" />

And in script i have a code:

print_r($_FILES);

After image choosing and sending form, I have an empty array $_FILES. Why?

+4  A: 

The form must be set like this:

<form action="myuploadpage.php" method="post" enctype="multipart/form-data">
...
</form>

So that the browser knows to send the image along with the data.

Vincent Ramdhanie
A: 

Have you set the form method to POST data to the PHP script and set the action to point to it? If so then you should be able to get something like $_FILES['image_file']['name']

robertom