# Binary upload and parsing with Rails

**URL:** <https://www.ruby-forum.com/t/binary-upload-and-parsing-with-rails/107279>\
**Category:** Rails\
**Created:** [June 20, 2007, 1:37am UTC](https://www.ruby-forum.com/t/binary-upload-and-parsing-with-rails/107279 "2007-06-20T01:37:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 20, 2007, 1:37am UTC](https://www.ruby-forum.com/t/binary-upload-and-parsing-with-rails/107279/1 "2007-06-20T01:37:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [June 20, 2007, 1:53am UTC](https://www.ruby-forum.com/t/binary-upload-and-parsing-with-rails/107279/2 "2007-06-20T01:53:12Z")

</div>

On 6/19/07, chirag [removed\_email\_address@domain.invalid](mailto: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.

> 1. 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
