0

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?

1
  • 1
    What language is this? That's probably the most important tag for you to have on a post. Commented Sep 18, 2009 at 17:31

2 Answers 2

4

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.

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

Comments

0

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']

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.