Forum Moderators: open

Message Too Old, No Replies

Form processing with file upload without multipart/form-data?

The client's host doesn't support forms with multipart/form-data!

         

Benek

10:19 pm on Jan 10, 2007 (gmt 0)

10+ Year Member



I'm helping a client setup form processing for some review submission forms on his site and he wants the ability for users to upload images with the form. I was going to use a standard form processing script like the one at form2email.net or some other similar script but they all require multipart/form-data and the clients host doesn't support forms with multipart/form-data. Is there a way to process forms and allow file uploads/attachments without using multipart/form-data?

rocknbil

9:04 am on Jan 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have never heard of this. Data is data. If you can post, you should be able to post multipart form data. I am more inclined to believe it's how the form processor is parsing out the data. So the most direct answer is no, you need multipart to upload files.

When you do ordinary parsing by post or get, the form processor only needs to unencode the data and split it into key/value pairs. Normally this is done by a simple hand-written parsing routine.

For multipart form data, it first has to find the multipart boundary and split it into the various parts, and parse each one accordingly based on the mime type of that part. So plain text parts are parsed as normal, binary parts, such as uploads, are written to files.

The best example is the perl module CGI.pm, which is not part of the standard distribution - it can parse multipart form data.

Benek

9:01 pm on Jan 11, 2007 (gmt 0)

10+ Year Member



So, just to be clear, are you saying that if the web server doesn't allow forms with multi-part/form-data that there is no way for me to create a form that allows a file upload along with text fields?

coopster

9:05 pm on Jan 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



No file uploads, period. You are correct.

rocknbil

9:08 am on Jan 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...are you saying that if the web server doesn't allow forms with multi-part/form-data...

Well, no, what I'm saying is I have never seen a server that **can't** accept multi part form data, and have never heard of it being denied. There is probably a way, but what I'm saying is if you can't parse multi part form data, it's a function of the program or script it's being sent to.

coopster

12:33 pm on Jan 12, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Keep in mind it may be prohibited permissions on the server-side.

piatkow

3:25 pm on Jan 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's what it sounds like to me. The OP's client appears to be using an external hosting service which has limited the functionality available.

Benek

9:06 pm on Jan 12, 2007 (gmt 0)

10+ Year Member



All I know is that I asked the host specifically do you support forms with multipart/form-data and they said no, you cannot do that. I didn't ask why or how. I imagine it's for security purposes?