-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
upload images #105
Comments
The reasons Rocket doesn't provide an implementation yet are somewhat nuanced and predicated on the fact that everything is streamed: how do you validate the multipart form, which includes arbitrarily sized field, without reading it all? One approach is to demand that fields are always the last elements of the form structure if streaming is desired for the entire form. Another approach is to have a "maximum file upload" size and read the request into memory for validation. Yet another approach is to have types that specify what should happen with the file portions of a multipart form: a 'NamedFile' would automatically save the stream to a temporary file, and a handle would be given to the matching route. I believe this last approach is the way to go, but I haven't explored it in depth. As a workaround, since your form is rather simple, you could implement a |
Could you help me? |
Handling this out-of-band. |
I just saw that I can grab the boundary information since 2da08a9 :) let mut mp = Multipart::with_body(data.open(), content_type.params.unwrap().string);
let entries = mp.save_all().to_entries().unwrap();
debug!("entries: {:?}", entries); But this doesn't work :( There are no entries :( |
Now I know my mistake: I have to remove the |
@flosse did you figure out the multipart? If so, would you be willing to share your code? I have been trying to figure this out for days. |
How can I upload an image?
This is the form I use:
Using a slightly modified code of the upload example form the docs:
Results in a textfile like this:
So how can I access the
filename
and how can I stream the image itself?The text was updated successfully, but these errors were encountered: