0

Mac でファイルをアップロード中に問題が発生しました。Windows dev環境では問題なく、ubuntu prodでは問題ありませんでしたが、ファイルをアップロードして解析しようとすると、Mac os 10.6.8でこれをスローします。

Errno::ENOENT in ProductsController#import_adjust

そのようなファイルまたはディレクトリはありません - /var/folders/v8/v8lBbdWcGJmntpbJRzGcfU+++TI/-Tmp-/RackMultipart20120824-71301-1aqop0s

フォームは次のとおりです。

<%= form_for :upload, :html => {:multipart => true}, :url => {action: "upload"} do |f| %>
  <%= f.file_field :my_file %>
  <%= f.submit "Upload" %>
<% end %>

そして、これはコードです:

def import_adjust
    case params[:commit]
      when "Adjust"
        @col_default = params[:col_data]
        #abort @col_default.to_yaml
        #update csv reader with form data, restore filters  from params
      when "Complete"
        #all ok, read the whole file
        #abort params.to_yaml
        self.import_complete
        return
      else
        @col_default = nil
    end
    #read first part of the file
    @tmp = session[:import_file]
    @csv = []
    source = CSV.open @tmp, {col_sep: ";"}

    5.times do
      line = source.readline
      if line.size>0
        @line_size = line.size
        @csv.push line
      end
    end

    #generate a selection array
    #selection = select_tag 'col_data[]', options_for_select([['name','name'], ['brand','brand'], ['delivery_time','delivery_time'], ['price','price']])
    #@csv = [selection * line_size] + @csv
  end
4

0 に答える 0