1

I have a PHP file upload form with method="post" enctype="multipart/form-data"

I am trying to do a <input type = "hidden" name = 'something' value = "something"/> along with the input for file upload, but I am not able to get the value of 'something' in the upload handling script like $_POST['something']

Is it not possible to use POST variables along with a file upload? Any other alternative on how I can pass information to the upload handling script?

1
  • 2
    This should work fine. Can you show the full HTML form, and the results of a print_r[$_POST]? Commented Jul 19, 2010 at 12:07

3 Answers 3

1

First, having some consistency with which quotes you use would be a good first step.

Second, you have got the enctype correct, so what may be an issue is you've exceeded the servers file upload size or post size settings. Try upload a smaller file and see if that works.

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

2 Comments

Thanks for pointing that out. I had set a rather low post size setting to meet my need. Increased it now and I have it working.
Thanks mate, glad I helped :-) If you would like you can mark this answer as the one which solved your question by clicking the tick next to it. Happy coding :-)
0

You can use other inputs along with the file upload fields.

Ensure that:

  • All fields are inside form tags
  • Youdidn't misspell field names and array indexes
  • You are using "double qutes" everywhere in your HTML (just in case)

To debug, try putting this code at the top of your script to see what is being passed:

echo '<xmp>';
print_r($_POST);
echo '</xmp>';

Comments

0

I know this question is old, but I'll post anyway... maybe I can help someone.

In my case the problem was the 'post_max_size' in php.ini.

Cheers.

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.