Reputation: 97
In Rails 4.0 Project, I am using multiple file upload plugin. Right now it is working via ajax request. Now, I want to avoid duplicate file upload and it should show proper validation message. Also as soon file upload page needs to refresh. How can I validate duplicate files and refresh the page?
Reference : http://hayageek.com/docs/jquery-upload-file.php#multi
Paperclip gem version is
paperclip (3.5.2, 2.3.11, 2.3.8)
In views,
<%= simple_form_for(@file, :as=>"file", :url=>create_files_path, :html=>{:multipart => true, :autocomplete=>"off"}) do |f| %>
<%= f.input :document, :as=>:file, :label =>false, :required => true %>
<% end %>
<script type="text/javascript">
$("#file_document").uploadFile({
url:"<%= create_files_path %>",
multiple:true,
showDone: false,
showProgress: true,
showError:true
});
</script>
Upvotes: 0
Views: 905
Reputation: 2865
Based on @Bjoernsen comment on MD5 digest I found this blog post which is also comparing files on S3. I believe this is also how git works using SHA-1 hashes.
Again, Thanks to @Bjoersen for pointing it out. I learnt something.
http://bytesofpi.com/post/24636043214/comparing-two-files-via-md5-hash-on-amazon-s3-using
Upvotes: 1