Is there a way to not have to reupload an image that's already in my application?
Hi,
I am building a recipes sharing and management application (Flask-SQLAlchemy and Hybrid PostgreSQL and MongoDB) and have successfully enabled logged in users to upload their recipe image with the use of Cloudinary's Public API Key.
But when the logged in user tries to edit his/her recipe post, the user needs to reupload an image (even though there's already one in the DB from when the recipe is first uploaded). I am struggling to fix this issue. Would you be able to provide some insight into how to deal with this?
Many thanks!
Joy
-
Hi Joy, thanks for getting in touch.
Could you tell me a little bit more about the edit workflow you have implemented? It would be great to know at what point the upload to Cloudinary is requested and how it's being done.
If you're using our Upload Widget as part of the process, then it expects a file to be uploaded, so I'd recommend taking the widget out of the equation entirely and just serve the image from the DB as you would any non-Cloudinary image.
I hope this helps. Looking forward to hearing back from you.
Thanks,
-Danny -
Hi Danny,
Thanks for the prompt reply to my query.
I'm using the SDK to allow the users of my Flask app to be able to upload their image. That part is working wonderfully, thank you.
When the users come to edit their post, though, I could do with some guidance on how to serve the image from the DB (as you said above) so I won't have to ask said users to reupload their image.
Many thanks!
Joy
-
Hi Joy.
I'm afraid I don't have any direct experience with Flask/PostgreSQL/Mongo, so I wouldn't be able to provide any specific instructions on retrieving from the database. I'm assuming that once a recipe is uploaded, it's visible for others to view somewhere on your site, so it should just be a case of recycling that code and adding an edit form for all fields besides the image.
We're able to help with questions related to using the Cloudinary SDKs. APIs and widgets, but I think at this stage your query is more around Flask itself, so a post in StackOverflow may get you better results.
I'm sorry we're not able to assist more directly, but please do feel free to reply here or raise a support ticket with us if you need guidance on using any of our products.
Thanks,
-Danny
Post is closed for comments.
Comments
3 comments