2014-03-05 80 views
0

在Rails 4.0 Project中,我使用了多个文件上传插件。现在它正在通过ajax请求工作。 现在,我想避免重复的文件上传,它应该显示适当的验证消息。也尽快文件上传页面需要刷新。我如何验证重复文件并刷新页面?避免重复文件上传 - Rails 4

参考:http://hayageek.com/docs/jquery-upload-file.php#multi

回形针宝石版本

paperclip (3.5.2, 2.3.11, 2.3.8) 

在观点,

<%= 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> 
+0

由它的内容或名称重复吗? –

+0

需要按文件内容检查 – shubhra

+1

最接近的是文件名,类型和大小,你不能容易地检查内容,特别是如果它的二进制。 – archie

回答