Does anyone know how I exactly I would post a file from a non-web client? In my case, I want to upload different file formats (.csv, .txt, etc) from the client''s file system. How does this work exactly if I''m not using a browser? What would be the format for the .REST POST? I''m using a .NET client new to that and not sure exactly how to POST an external file from a non-web client through REST Thanks Chirag PS. I''m using attachment_fu plugin which automatically creates a REST controller on the server side --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You would send the file just like a browser would. Use a multi-part form with your file attached. Here''s an example of sending a file with curl: curl -F password=@/etc/passwd www.mypasswords.com Notice the -F tells curl to use multipart/form-data according to RFC1867. If curl can do it, I''m betting that .Net can too. :-) On Jun 22, 4:22 pm, chirag <patel...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> Does anyone know how I exactly I would post a file from a non-web > client? In my case, I want to upload different file formats > (.csv, .txt, etc) from the client''s file system. How does this work > exactly if I''m not using a browser? What would be the format for > the .REST POST? > > I''m using a .NET client new to that and not sure exactly how to POST > an external file from a non-web client through REST > > Thanks > Chirag > > PS. I''m using attachment_fu plugin which automatically creates a REST > controller on the server side--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I don''t completely understand the "-F" switch Is "password=@/etc/passwd" a path on the file system? How would I send a .csv file in the same directory? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
password is the field name and /etc/passwd is the file (on the file system) you want to upload. On 6/23/07, chirag <patelc75-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > I don''t completely understand the "-F" switch > > Is "password=@/etc/passwd" a path on the file system? > > How would I send a .csv file in the same directory? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I tried the following comnmand curl -F "uploaded_data=@curltest.docx" http://localhost:3000/raw_data_files/create> results.htmland got the following errors from attachment_fu (file upload) plugin There were problems with the following fields: * Content type can''t be blank * Size is not included in the list * Size can''t be blank * Filename can''t be blank Here''s my view which works fine on the upload (unlike cURL): <%= error_messages_for :raw_data_file %> <% form_for(:raw_data_file, :url => raw_data_files_path, :html => { :multipart => true }) do |form| %> <p> <label for="uploaded_data">Upload a file:</label> <%= form.file_field :uploaded_data %> </p> <p> <%= submit_tag "Create" %> </p> <% end %> How do I manually set the filename, size, and content type in cURL? Chirag On Jun 24, 3:04 am, "Bruno Celeste" <bruno.cele...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> password is the field name and /etc/passwd is the file (on the file > system) you want to upload. > > On 6/23/07, chirag <patel...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > > I don''t completely understand the "-F" switch > > > Is "password=@/etc/passwd" a path on the file system? > > > How would I send a .csv file in the same directory?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---