# Webrick upload file issue

**URL:** <https://www.ruby-forum.com/t/webrick-upload-file-issue/74817>\
**Category:** Ruby\
**Created:** [November 7, 2006, 10:58am UTC](https://www.ruby-forum.com/t/webrick-upload-file-issue/74817 "2006-11-07T10:58:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![name\_pipe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@name\_pipe](https://www.ruby-forum.com/u/name_pipe)\
**Post date:** [November 7, 2006, 10:58am UTC](https://www.ruby-forum.com/t/webrick-upload-file-issue/74817/1 "2006-11-07T10:58:01Z")

</div>

Hello,

Is there any feature in webrick using which we can upload our files  
directly. I am talking about the files which are submitted using  
 tag.

Thanks

---

<div class="post-metadata">

**Author:** ![name\_pipe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@name\_pipe](https://www.ruby-forum.com/u/name_pipe)\
**Post date:** [November 7, 2006, 11:00am UTC](https://www.ruby-forum.com/t/webrick-upload-file-issue/74817/2 "2006-11-07T11:00:54Z")

</div>

Can anyone help me on this ?

---

<div class="post-metadata">

**Author:** ![name\_pipe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b5a626/32.png) [@name\_pipe](https://www.ruby-forum.com/u/name_pipe)\
**Post date:** [November 7, 2006, 11:01am UTC](https://www.ruby-forum.com/t/webrick-upload-file-issue/74817/3 "2006-11-07T11:01:17Z")

</div>

On 11/4/06, name pipe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can anyone help me on this ?
> 
> On 11/3/06, name pipe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hello,
> > 
> > Is there any feature in webrick using which we can upload our files  
> > directly. I am talking about the files which are submitted using  
> > tag.
> > 
> > Thanks

Try using cgi lib, [http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/index.html](http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/index.html)

Get multipart form values

require “cgi”  
cgi = CGI.new  
value = cgi[‘field\_name’] # \<== value string for ‘field\_name’  
value.read # \<== body of value  
value.local\_path # \<== path to local file of value  
value.original\_filename # \<== original filename of value  
value.content\_type # \<== content\_type of value

and value has StringIO or Tempfile class methods.

Now you have to figure out how to connect those two 😉
