I’m pretty new with using Render and uploading flask API, I tried doing GET request and it works. But I have this POST request which user need to upload a file, I want to know where does the uploaded file go? does it temporary holds until the request finished? Thanks in advance🎉
f = request.files['file']
return "Upload successfully!"
I’ve replied to the ticket you also opened. Uploads will save wherever your code specifies to save them.
However, Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).
If you want to use file uploads on your service, you’ll need to have a persistent store, e.g. a Render Disk (which is chargeable and also require a paid instance type) or an external service like AWS S3.
I didn’t specify where it will be stored, I will just use my flask API so I can upload the uploaded file to another API (like bridge). So, basically it will not be stored in Render? Lastly, will my plan work if I do the bridge stuff I wanna do? I apologize, I kinda new to some of the words. Thanks for explaining🎉
The Flask documentation on uploading shows setting an upload folder: https://flask.palletsprojects.com/en/2.3.x/patterns/fileuploads/
If you want to store the uploads between service restarts, you’ll need a disk, with the upload folder in the code pointing to the “Mount Path” of the disk.
Thank you very much, for explaining🎉