Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save uploaded file in Rails 2

Hi I have integrated Zoho sheet in Rails 2 app , where I can open new Zoho Sheet from local , but when i click on save at zoho editor , it will send me the file to my server, this is my production log

 Processing ZohoController#index to #<File:0x6a49f88> (for *.*.*.*      at 2015-10-08 11:24:08) [POST]
  Parameters: {"controller"=>"zoho", "filename"=>#      <File:/tmp/RackMultipart20151008-2490-oxplae-0>, "content"=>#<File:/tmp/RackMultipart20151008-2490-3r5nf3-0>, "eventsource"=>#<File:/tmp/RackMultipart20151008-2490-yj8j8h-0>, "format"=>#<File:/tmp/RackMultipart20151008-2490-1nfald4-0>, "id"=>#<File:/tmp/RackMultipart20151008-2490-yeqxb8-0>, "action"=>"index"}
 ActionController::InvalidAuthenticityToken

I couldn't fetch the file , can anyone please help me out how can access file, even though i inspected each params , but i couldn't achieve Any help is valuable

like image 986
Sanju B Myh Avatar asked Oct 08 '15 12:10

Sanju B Myh


1 Answers

The server log shows "Invalid Authenticity Token" message. This means that the token saved by rails server in a previous requests cookie did not match the token sent with your POST request.

If this is the first interaction for this service/server and no previous token is available, you an skip this validation for this particular action (i.e index action)

class FooController < ApplicationController


 protect_from_forgery except: :index

For further understanding this topic please see Understanding the Rails Authenticity Token

like image 101
Kan Avatar answered Oct 15 '22 14:10

Kan