Forum: Ruby on Rails binary upload and parsing with Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
chirag (Guest)
on 2007-06-20 03:37
(Received via mailing list)
1. What is the best way for me to upload a binary file to a Rails
site? I'll be uploading from a .NET client.

2. What is the best way to parse the binary file to extract the data?
Would I need to "drop" to C and read the binary file that way?
Jeremy K. (Guest)
on 2007-06-20 03:53
(Received via mailing list)
On 6/19/07, chirag <removed_email_address@domain.invalid> wrote:
> 1. What is the best way for me to upload a binary file to a Rails
> site? I'll be uploading from a .NET client.

Do a PUT request with Content-Type: application/octet-stream,
Content-Length: yourfilesize, and send the file verbatim as the
request body.

> 2. What is the best way to parse the binary file to extract the data?
> Would I need to "drop" to C and read the binary file that way?

Read the body using request.raw_post

jeremy
This topic is locked and can not be replied to.