- Home /
multipart/form-data Does WWW Class send the trailing boundary?
Using Unity 4
I have an issue with trying to upload files to my Coldfusion 9 server but the server keeps erroring with a 500 Server Error...Upon looking at the traces I see the form post data, and everything looks good..except I do NOT see the trailing -- BOUNDARY -- after all the file data.
When trying to post this file using Unity WWW Class to an earlier version of ColdFusion (6.1) I get THIS error: 500 Corrupt form data: no leading boundary: != --ZjIHIqaav3E7lJvquiSIbmOYH9g8z1TqWQUtsrAW
Again something with the boundary...although the leading one is there...I see it in the IIS Failed Request Log
Can someone confirm that WWW DOES send the trailing boundary? Or any other possible reasons why Coldfusion chokes on this form post?
Is there a way to output the whole request to the Debug.Log before it sends it so it can be inspected?
Thank you! Ryan
I can't help you directly - I've never done form posting with WWW. However, I will point out that WWW is fairly limited in what it sends. There have been complaints about this for years. The reason is the webplayer: lots of things aren't allowed from within a plugin, and WWW's philosophy is to only support features that are allowed everywhere.
You can try other ways of sending your request (e.g. through .NET's HttpWebRequest.
If you want to see what's included in the WWW, can you send it to a port on localhost and output it from there? Presumably you want to see more than the data and headers available in the WWWForm?
http://docs.unity3d.com/Documentation/ScriptReference/WWWForm.html
Thanks for the reply! I found a utility called Fiddler that let's me inspect the requests, copy them and, well, Fiddle with them. This has been a great help and I confirmed that Unity DOES include the trailing boundary. $$anonymous$$y problems with Coldfusion however have found a few things that are not compatible...Unity WWW seems to add an extra cr/lf after the headers. It also adds a content-type to each field on the form..Coldfusion seems to only want it on the FILE field and 500 Internal Errors if anything is amiss...But I am still testing and will post back when I have some conclusion.
Answer by zzzzz · Dec 06, 2013 at 06:57 PM
Yes Unity does send the proper Boundary...but the WWW Class is still broken. Sends an extra CR/LF after headers. Content-Length is inconsistent and uneditable. Sends a Content-Type field for each field in form instead of just for FILE field.
Unfortunately There is no answer for this. The WWW Class is just not ready for prime time. I gave up and bought Uniweb and then found out that it required Unity Pro to run on mobile.
So I went the LONG and Ridiculous route. I bought BOXIT, setup a Dropbox account and sent the images to dropbox and then pulled them down from the server.
Seriously guys, I have been developing in Unity for 5 weeks and have already upgraded Unity to new versions 5 times. You would think a faulty WWW Class in this day and age would get a little love from the developers....
My $.02, Ryan
Your answer
Follow this Question
Related Questions
Post Requests without Coroutines 2 Answers
HTTP Response Headers? 3 Answers
Try catch alternative for HTTP request 1 Answer