help in uploading a file to the server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

help in uploading a file to the server

Post by jasongr »

Hi people

I have the following form:

Code: Select all

<form name="formname" method="post" action="test.php" enctype="multipart/form-data">
<input name="mode" id="mode" type="hidden"></input>
<input id="file" name="file" type="file" size="50" accept="image/*"></input>
</form>
When I submit this form to my test.php page

I iterate over $_POST to see verify that I got all the parameters.
For some reason the 'file' parameter was not sent to the server

However, if I change the enctype of the form to: multipart/mixed
Then the 'file' parameter does indeed get sent to the server, however I cannot find it in the $_FILES
array. I do find it in the $_POST array. It is as if it is not treated as a file input parameter

any suggestions?
All the reading that I have done so far lead me to believe that the value of encype should be multipart/form-data

thanks in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

when sending files $_POST will not have the file field, it will be in $_FILES.
Post Reply