# Upload problem when file is small/StringIO

**URL:** <https://www.ruby-forum.com/t/upload-problem-when-file-is-small-stringio/59479>\
**Category:** Rails\
**Created:** [May 3, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/upload-problem-when-file-is-small-stringio/59479 "2006-05-03T19:08:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ant\_Peacocke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/779978/32.png) [@Ant\_Peacocke](https://www.ruby-forum.com/u/Ant_Peacocke)\
**Post date:** [May 3, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/upload-problem-when-file-is-small-stringio/59479/1 "2006-05-03T19:08:26Z")

</div>

Hi

I am having a problem with uploading small files.

These are StringIO objects rather than temporary files as with the  
larger file uploads.

The problem is that when it is a StringIO rather than a temporary file  
nothing is returned from the read method.

example code where “image” is the file upload form parameter, it works  
fine if image is over round 19k:

File.open(path\_1 + path\_2, “wb”) {|f| f.write(image.read) }

Cheers  
Ant

–  
Ant Peacocke

[www.levelsystems.net](http://www.levelsystems.net)  
T: + 33 (0) 8 70 46 63 37  
M: + 33 (0) 6 09 81 06 00
