# Uploading File to Web Service

**URL:** <https://www.ruby-forum.com/t/uploading-file-to-web-service/142392>\
**Category:** Rails\
**Created:** [July 7, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/uploading-file-to-web-service/142392 "2008-07-07T15:12:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paerez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5fc32e/32.png) [@paerez](https://www.ruby-forum.com/u/paerez)\
**Post date:** [July 7, 2008, 3:12pm UTC](https://www.ruby-forum.com/t/uploading-file-to-web-service/142392/1 "2008-07-07T15:12:41Z")

</div>

Hey Guys,

I created a web site where I could upload videos, it’s built using RoR  
and RESTful urls. Videos#create lets me upload videos.

Next, I created another app, which using activeresource to interact  
with the first site. So, I want the user to upload a file to the  
client app, which then posts it via activeresource to the server app.

In the client app I get the file, but then I try to do this:  
video\_file = File.open params[:clip][:file].local\_path, “r”  
clip = Clip.new(:name =\> params[:clip][:name],  
:description =\> params[:clip][:description],  
:file =\> video\_file)

Clip is the ActiveResource object for the server. On the server  
params[:clip][:file] comes out null.

Let me reply to the answers I expect to come up in advance:

1. No, I cannot have the client post directly to the server
2. I tried Base64 encoding the data and sending as a string, but it  
takes incredibly long to convert and post 100 megs of video via  
Base64. I figure if the user can send to the client in binary, then  
the client should be able to send to the server the same way.

Thanks
