ruby on rails - How can I prevent double file uploading with Amazon S3? -
I have decided to use Amazon S3 for document archiving to create an app. One issue I run, as long as the file is required to be uploaded in S3, I need to create a document object in my app so that my users can complete the CRUD tasks.
Dual upload to a solution. A user uploads a document on the server, my train app remains. I validate the object and then pass it on the S3. With this one issue progress indicators become more complex. Using most out-of-the-box plug-in will show the client that the upload of the file has ended because it is on my server, but then there will be a decent delay when the file was going from my server to S3. It also offers unnecessary bandwidth (at least it does not seem necessary)
I am thinking that the second solution is to upload a file directly to S3 with an AJAX request , And when it succeeds, do another, AJAX request to store objects in my database Here is an issue that I have to validate the file after upload, which means that I have some clean up in the S3 A E will run if the validation fails.
Both look equally messy.
Has anybody done more elegant work that they will not mind sharing? I think this is a normal situation "cloud storage" is quite popular today. Maybe I'm seeing this wrong.
Unless there is a specific reason for not using a paperclip, I would highly recommend it. A user with a delayed job and delayed paperclip is uploaded to the file server in your server file system, where any verification that you require, a delayed job is processed and stored on S3 is. In fact, really easy to install and better user experience.
Comments
Post a Comment