Hello Everyone,
i posted something similar 8 months ago… but i have a few updates to what i know now:
i have a webservice created with C#, it allows for uploading files
i used a tool like Fiddler to test it, it is working perfectly
using Corona the code is working but the files are not being uploaded
so i ran the webservice in debug mode and here are the main differences between Corona and Fiddler:
- File size sent by Fiddler is slightly larger than Corona’s for the same file, i think this is because Fiddler sends the headers and Body size and everything passed through http, while Corona is sending the exact bytes of file size only, as seen by using Windows-Properties-Menu for that file
- Headers passed by fiddler does not have the value named Keep-Alive and this value is always passed by corona automatically not by me, and i don’t know where is it coming from or what it is … the first header value passed by fiddler is the file size, in corona file size is the second value
- Corona Help suggest using Content-Type to be “image/jpeg” while Fiddler sends this value “multipart/form-data” even after trying to use this value in corona, no error occurs but no successful uploading
- in Fiddler there’s something called boundary as well … below is Fiddlers Header output
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Host: localhost:6991
Content-Length: 2645
and Fiddlers Request Body
---------------------------acebdf13572468
Content-Disposition: form-data; name=“fieldNameHere”; filename="abc.jpg"
Content-Type: image/jpeg
<@INCLUDE *D:\Lua\Projects\WSUpload\images\abc.jpg*@>
---------------------------acebdf13572468–
in Corona i used both network.upload, and network.request … the webservice is being called, all headers and parameters are showing, but Request.Files.Count=0 from .Net Code which returns one Request.Files.Count=1 in Fiddlers case
the main difference is that in debug mode in .Net>>>> for Fiddler
Request.Headers(0)=2645
which is the file size
>>>>and for Corona
Request.Headers(0)=Keep-Alive
and
Request.Headers(1)=2453
i’m sure my whole problem is in setting up headers , and body properly… although corona help does not mention setting up the body unless you are using network.request for the upload process
so mainly what is
- Keep-Alive and how to get rid of it
- use multipart/form-data or image/jpeg
- and why file size is different
i really need to get this working, if it is a problem between .Net and Corona then i can learn a few PHP lines of code and create the service because i have pending projects because of this feature
Please Help anyone…
Regards,
Tariq