Skip to content

How to return files from routes? #3066

Answered by robjtede
jsoneaday asked this question in Q&A
Discussion options

You must be logged in to vote
if let Ok(Some(bytes)) = field.try_next().await {
  println!("image found");
  image = Some(bytes);
}

This is incorrect. bytes here is actually a chunk, not a complete file, so you need to append each chunk uploaded to a buffer before it is a complete image

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@robjtede
Comment options

Comment options

You must be logged in to vote
2 replies
@robjtede
Comment options

Answer selected by jsoneaday
@jsoneaday
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants