Best way to handle temporary user-uploads in web-development?

Viewed 22

Hello on the overflow,

I am fairly new to web development so please don't crucify me.

I am currently in the process of laying out the foundation for a web-app (using Django as backend) that will involve user uploads (blob-files). The application will perform some machine learning on the upload and present the output to the user in the browser.

Once presented with the output, the user will have the option to save the upload to that particular user's subfolder in the bucket (assuming cloud storage will be used).

How do I best deal with the upload while it is temporary, that is, before the user has decided to save it to storage?

The above may reveal a crucial misunderstanding of mine in how the user interacts with the server, however, I can see this as one solution:

Creating a temporary folder for each user in the bucket, where an upload is stored until the user either decides to save it (move to proper folder) or not to save it (delete it from temporary folder).

Is this solution totally bonkers and is there a much easier one?

I look forward to any replies.

Sincerely, an aspiring web developer

1 Answers

Hi @HighPriestPete!

I never thought about this use case before, it's a very good question.

I have two ways in my mind :

  • You may use Django's built-in media system first. It's stored in your built-in media folder until the user either decides to save it (move to the proper folder) or not to save it (delete it from the temporary folder). And after the decision, you may delete the user upload in your media folder.
  • You may use 2 AWS Bucket. The first bucket might be for temporary files, and the second might be for the persistent bucket. It's stored in your first bucket until the user either decides to save it (move to the proper folder) or not to save it (delete it from the temporary folder). And after the decision, you may delete the user upload in the first bucket.

I hope it works for you!

All the best!

Related