question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to overwrite UploadFile impl

See original GitHub issue

In our case we’re streaming in-flight uploaded files directly to MongoDB GridFS, so if we lose/crash some asgi worker process that is actually using the uploaded yet unprocessed file, a schedule job can detect this and resume operation. With SpooledTemporaryFile this is impossible because we can’t guarantee that resume job will land in the same container.

This all works well with Starlette, only drawback is that we need to monkey-patch UploadedFile class with our implementation, that sends chunks to Mongo’s GridFS.

Can Startlette have UploadedFile class configurable?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zevisertcommented, Nov 4, 2022

Bump here from discussion https://github.com/encode/starlette/discussions/1934 - I can provide my own complex parsing, but there’s overhead that I can’t get rid of by having to read the spooled file from start to finish a second time. I hoped to be able to have starlette use a custom UploadFile subclass, as that would be a great place for us to add the logic we wanted.

0reactions
tomchristiecommented, Feb 16, 2022

Going to close this off for now with the same justification as https://github.com/encode/starlette/issues/849

Out of scope. If ya need more complex parsing than we currently provide, you need to do so within your own project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery file upload - how to overwrite file NOT rename
If you using UploadHandler.php that is exists in the wiki it's simple. In the get_file_name method you should replace this line:
Read more >
One Missing Step to Uncheck Overwrite Existing Files in ...
You click Upload document from the ribbon, and get the dialog box below. You have the option to “overwrite existing files” and it...
Read more >
Using FileUpload - Apache Commons
The factory implementation that currently ships with FileUpload stores the item's data in memory or on disk, depending on the size of the...
Read more >
Uploading and copying objects using multipart upload
Upload a single object as a set of parts independently using the multipart ... as a previously uploaded part, the previously uploaded part...
Read more >
Java file upload by example with Servlets & JSPs
You will need to perform the following steps to create a Java Servlet file upload component: Create a basic HTML or JSP file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found