Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload #2

Open
haseebyf opened this issue Dec 16, 2011 · 12 comments
Open

File upload #2

haseebyf opened this issue Dec 16, 2011 · 12 comments

Comments

@haseebyf
Copy link

RoutingHTTPServer seems quite promising and it has already helped me alot. Thanks for sharing it.

Question: How do i upload file using RoutingHTTPServer. can you please include an example for it.

@mattstevens
Copy link
Owner

Good idea, I'll add it to the sample project.

@mattstevens
Copy link
Owner

I've added a very basic sample, in your route you can access the body data through [request body]. If you're using an HTML form to upload the file you'll need to parse the form data yourself today. There's also no handling of large uploads yet; the entire file goes into memory.

@haseebyf
Copy link
Author

wow great...looking into it right now. I have to upload large files, so I might have to play around with it a bit. I am trying to replace the original buggy server in PlayerXtreme.

BTW, I am beginning to love RoutingHTTPServer, the simplified routing and blocks has made life easy for me.

@dhjdhj
Copy link

dhjdhj commented Nov 23, 2012

Does the upload use chunks so that the iPad won't kill the process if too much RAM is used for a large document?

Ooops -- just read your earlier post --- no handling of large uploads --- is that coming soon?

@dhjdhj
Copy link

dhjdhj commented Nov 23, 2012

Given how simple it is to create routing, it would be great if the library also had a nice high level abstraction to get uploaded files without the need for user to parse the data directly.
(just my two cents)

@mattstevens
Copy link
Owner

Uploads aren't something I've needed myself yet but there have been a number of requests for it, if I get some time I'll look into adding it.

@cwoloszynski
Copy link

When you say 'uploads', are you saying support a chunked POST to the server that efficiently writes the POSTed data to a file and avoids keeping the entire POST data in memory?

If that is the goal, then I am also interested in that!!!

Charlie

On Nov 24, 2012, at 11:15 AM, Matt Stevens wrote:

Uploads aren't something I've needed myself yet but there have been a number of requests for it, if I get some time I'll look into adding it.


Reply to this email directly or view it on GitHub.

@mattstevens
Copy link
Owner

Yep, that's it.

@dhjdhj
Copy link

dhjdhj commented Nov 24, 2012

I've been looking at this --- I will have to do a quick hack to get something that will work in the short term but ideally, along with the dictionary of headers that become available when one responds to a POST request, there could be an array of "Boundary" items, where each entry would be a dictionary with the parameters that come back in a boundary (e.g, the content type, disposition, filename etc) and an NSData blob representing the actual uploaded file.
That way, the user of the library could simply iterate the array, look at the type of the content and then just process each blob as appropriate.
Probably easier to start with a non-chunked version and then do the chunking later.

@cwoloszynski
Copy link

That seems very much the opposite of whatI was looking for. I am looking for something that does NOT keep all the posted data in memory.

On Nov 24, 2012, at 12:01 PM, dhjdhj wrote:

I've been looking at this --- I will have to do a quick hack to get something that will work in the short term but ideally, along with the dictionary of headers that become available when one responds to a POST request, there could be an array of "Boundary" items, where each entry would be a dictionary with the parameters that come back in a boundary (e.g, the content type, disposition, filename etc) and an NSData blob representing the actual uploaded file.
That way, the user of the library could simply iterate the array, look at the type of the content and then just process each blob as appropriate.


Reply to this email directly or view it on GitHub.

@dhjdhj
Copy link

dhjdhj commented Nov 24, 2012

I understand --- I think both are needed, it depends on what's being posted and why.

For your example, the array that came back would have filenames rather than the actual blobs and the developer could then reload (or move) the data as needed.

@cwoloszynski
Copy link

Yes, that would be sweet!

On Nov 24, 2012, at 12:09 PM, dhjdhj wrote:

I understand --- I think both are needed, it depends on what's being posted and why.

For your example, the array that came back would have filenames rather than the actual blobs and the developer could then reload (or move) the data as needed.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants