Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3-2. Multiple file uploading. Ruby issue
    primarykey
    data
    text
    <p>I am using Carrierwave for file uploading and have got the following form, which allows me to submit several files:</p> <pre><code>&lt;%= form_tag load_patterns_contacts_path, multipart: true, multiple: true do %&gt; &lt;%= file_field_tag 'qqfile[]', id: "upload_pattern", multiple: true %&gt; &lt;%= submit_tag "Load", id: "save_pattern", :class =&gt; 'btn btn-primary btn-success', multiple: true%&gt; &lt;% end %&gt; </code></pre> <p>Here is the code in my controller, which load submited files to the server:</p> <pre><code> @uploader = EmailPatternsUploader.new params[:qqfile].each do |p| tempfile = open(p.original_filename) puts tempfile @uploader.store!(tempfile) end redirect_to contacts_path flash[:success] = "Uploaded successfully." </code></pre> <p>It works fine, if filename looks like "text.xlsx", "image.jpg" etc. But if it is contains special symbols like "_partial.html.erb" then I have got Errno:ENOENT (No such file or directory - _partial.html.erb)</p> <p>I have tried to add </p> <pre><code>CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\_\-\+]/ </code></pre> <p>in my carrierwave.rb initializer, but it gives no result.</p> <p>Thanks in advance for help!</p> <p>UPDATE:</p> <p>I have understood, that the problem not in special symbol "_", but in the fact, that samples I am trying to upload contains two dots ("."). I think I need to modify regular expression in order to avoid two dots</p> <p>UPDATE:</p> <p>I am sorry for the last comments. I have understood, that the matter not in special symbols at all and not in a name of file. The problem that <strong>i can upload files only from {Rails.root} path</strong>. If I choose another directory, I have got aforementioned error and cannot upload a file. How can I configure Carrierwave path directory?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload