swisspol/GCDWebServer

Upload Example in Read Me

Closed this issue · 2 comments

Would it be possible to get the Upload and Download examples added to the Read Me?
There is a section "Final Example: File Downloads and Uploads From iOS App" at the bottom but its blank with no content and no examples. I'm ideally looking for Objective C code but I may be able to figure it out from a SWIFT example as well.

I've managed to get the download file working, however I now need to get a file to my app from the webpage and I can't for the life of me figure out how to do it.

Thanks
Plasma

This section in the README is certainly not blank. Maybe you didn’t download it entirely?

I'm talking about this section at the very end of the Read Me, shows the same on the main page in GItHub and if I select the README.md file directly ...

Screenshot 2020-01-30 at 16 13 23

There is no content or examples that I can see? I'm not wanting to use the HTML 5 Uploader, I want a simple form with an upload button to send a simple text / config file in to my app for parsing. I guess the HTML would look something like this:

             <form action="/upload" method="post" enctype="multipart/form-data">
                        <input type="file" id=\"config\" name="config" accept=".plist" size=40>
                        <input type="submit"> 
                 </form> 

I can get that to trigger a POST method in the app for /upload, and I have confirmed in Wireshark that the form data is sent.

I can also see the data land with GCDWebServer...

[DEBUG] Connection on socket 20 preflighting request "POST /upload" with 2057 bytes body
[DEBUG] Connection on socket 20 processing request "POST /upload" with 2057 bytes body

The data is there but I am struggling to get at the body / file contents from inside the method. If you could advise how that is done that would be great.

Thanks in advance.

Plasma