# Getting StringIO in Mozilla and String in Safari for file up

**URL:** <https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403>\
**Category:** Rails\
**Created:** [February 7, 2008, 11:55am UTC](https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403 "2008-02-07T11:55:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravanankrishnan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@saravanankrishnan](https://www.ruby-forum.com/u/saravanankrishnan)\
**Post date:** [February 7, 2008, 11:55am UTC](https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403/1 "2008-02-07T11:55:38Z")

</div>

Hi Folks,

```
      When i try to upload files, its working in both Mozilla and

```

IE. But It’s not working in Safari. The reason is,mozilla has StringIO  
class and safari has string class. My controller codings are based on  
StringIO. So that its not working in safari(ie its failed to read the  
file).I cant able to proceed further. Can any one help me.

Thanks in Advance  
Saravanan.K

---

<div class="post-metadata">

**Author:** ![saravanankrishnan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@saravanankrishnan](https://www.ruby-forum.com/u/saravanankrishnan)\
**Post date:** [February 7, 2008, 1:51pm UTC](https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403/2 "2008-02-07T13:51:39Z")

</div>

On 7 Feb 2008, at 10:55, Saravanan K. wrote:

> file).I cant able to proceed further. Can any one help me.

The body of a post will be a StringIO, TempFile or (if the form type  
isn’t multipart) a String.  
You just need to cope with those possibilities. Are you setting the  
mime type of the post correctly ?

Fred

---

<div class="post-metadata">

**Author:** ![saravanankrishnan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@saravanankrishnan](https://www.ruby-forum.com/u/saravanankrishnan)\
**Post date:** [February 7, 2008, 2:37pm UTC](https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403/3 "2008-02-07T14:37:00Z")

</div>

Frederick C. wrote:

> On 7 Feb 2008, at 10:55, Saravanan K. wrote:
> 
> > file).I cant able to proceed further. Can any one help me.
> 
> The body of a post will be a StringIO, TempFile or (if the form type  
> isn’t multipart) a String.  
> You just need to cope with those possibilities. Are you setting the  
> mime type of the post correctly ?
> 
> Fred

Thanks for your quick reply Fred.

I’m using following form tag

`
<% form_for :taxfile,:url=>{:controller=>'taxpayer', :action=> 
'upload_taxfile'}, :html=>{ :multipart=>true} do%>
<%=file_field :taxfile,:uploaded_data,:size=>"15" %>
`

I didn’t set any mime types in config files.

Thanks  
Saravanan

---

<div class="post-metadata">

**Author:** ![saravanankrishnan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@saravanankrishnan](https://www.ruby-forum.com/u/saravanankrishnan)\
**Post date:** [February 7, 2008, 2:43pm UTC](https://www.ruby-forum.com/t/getting-stringio-in-mozilla-and-string-in-safari-for-file-up/128403/4 "2008-02-07T14:43:44Z")

</div>

On 7 Feb 2008, at 13:37, Saravanan K. wrote:

> > 
> 
> \<%=file\_field :taxfile,:uploaded\_data,:size=\>“15” %\>

Setting :multipart =\> true is all you should need to do. I think  
you’ll just have to deal with whatever rails throws at you.

Fred
