Reputation: 5843
I am trying to make a php script to upload files. From my understanding so far, enctype="multipart/form-data"
sends certain type of header to http to make uploading file possible. Now what I don't know is what exactly those information are. Is there anyway I can echo or view that header file? Also, the reason that I am interested in this is because I wanted to edit(Add) some of the information in header.
Basically what I am going for is whenever a user selects a file from <input type="file"/>
I want to append it in the header so that the information is saved (I will probably use session to store those information) and user can continue to select other files. I know there is <input type="file" multiple/>
to select multiple files but the approach I am going for is a bit different.
Thanks in advance.
Upvotes: 2
Views: 1127
Reputation: 4415
From my understanding so far, enctype="multipart/form-data" sends certain type of header to http to make uploading file possible.
Yes
Also, the reason that I am interested in this is because I wanted to edit(Add) some of the information in header.
Why? You cannot edit the header information until the request has arrived on your server. Then there is no point?
Basically what I am going for is whenever a user selects a file from < input type="file"/ > I want to append it in the header so that the information is saved (I will probably use session to store those information)
The data is only sent, when the <form>
has been submitted, and then all the selected files are POST
'ed
To allow an indefinite amount of files, you can use <input type="file" name="attachment[]">
and use javascript to allow users to add attachments.
There are also plenty of very nice uploaders available;
<input type="file" multiple/>
is only supported by HTML5, so not recommended for usage yet.
Upvotes: 2