search for: stringio

Displaying 20 results from an estimated 98 matches for "stringio".

Did you mean: stringi
2006 May 24
0
POST op parameters are coming in as StringIOs
I''m receiving a multipart post request from another server. The request parameters are being received as StringIOs, rather than plain strings. For instance : Processing MessagesController#receive (for 83.166.68.31 at 2006-05-24 10:36:53) [POST] Session ID: eedafb24033be0714f8133f02810083f Parameters: {"message"=>#<StringIO:0xb7503358>, "date"=>#<StringIO: 0xb750...
2006 Apr 03
0
N file uploads from one post - one File, (N-1) StringIOs
All, Win XP Ruby 1.8.4 Rails 1.1 I have a multipart form that I am posting with a dynamic number of file_fields that are generated on it, say N. When I post this form and look at the form params, I see one "File" object and N-1 "StringIO" objects. It appears that I should be able to manipulate these the way that I would like (file-wise), so I think it''s not a problem. I''ve verified that regardless of the number of file fields N, if N > 1, then I will get a File object and (N-1) StringIO objects. Anyon...
2006 Apr 03
4
Multiple file uploads - only one file object gets posted
...+= 1 end %> I browse for 3 of the many files, and submit the form: When I look at params in the controller, I see: "0"=>{"fileobj"=>#<File:C:/DOCUME~1/WESLEY~1/LOCALS~1/Temp/CGI2444.0>} but the other two indices for which I expected File objects only show StringIO objects. Why do I not see 3 files objects in my parameter array when I "Browse..." to three files and submit my form? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
2006 Aug 09
5
HELP!!! New to Ruby
Hi all, I am new to Ruby programming language. I know that require ''gemname'' is used for using some gems in our application. I have a sample application developed in Ruby on Rails which have the following lines of code: require ''zlib'' require ''stringio'' Can you plz help me to know what these gems are used for. It would be very helpful if you could give some hyperlinks to some articles that explains them in detail.. Thanks in advance, Janeve -- Posted via http://www.ruby-forum.com/.
2013 Mar 15
2
Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
...n Icalendar''s Parse than with a file? I''m currently sending the file using the curl command... curl -v --data-urlencode ics at invite.ics http://127.0.0.1:4567/ics2event I''ve tried curl''s --data-binary and sinatra''s request.body.string to create the stringio object, without luck. Ultimately it complains NoMethodError at /ics2event undefined method `bytesize'' for #<Icalendar::Calendar:0x9c8b1b8> file: component.rb location: method_missing line: 419 My web code is below. require ''sinatra'' require ''rubygems'...
2006 May 01
0
Upload problem when file is small/StringIO (read method return nothing)
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...
2006 Apr 12
0
StringIO - getting filename for multipart form uploads?
All, When using multipart forms, sometimes the files come into the controller as StringIO objects. I assume that by the time I get a StringIO object, I can''t get the name of the file the way that I might be able to using File.original_filename, correct? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
2006 Apr 29
0
Upload problem when file is small/StringIO
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...
2006 Dec 17
1
file_column error: StringIO Instead of Temp_File
...different names and DOM IDs so there isn''t a problem with the multiple upload. The problem is when i try to upload a file (or 2, or 3) sometimes it works, but sometimes i get this in the log file: "bar_image"=>{"file_temp"=>"", "file"=>#<StringIO:0xb4b08268>} and the picture is not saved. the pictures i upload are 60x60 and there is no file_column validations or limitations at all. when uploading larger images (500x500 for ex.) it works. anyone? --~--~---------~--~----~------------~-------~--~----~ You received this message because...
2006 Feb 01
1
Class of uploated file
Hi, i have small problem when you upload file by input type=file to rails then in rails it is represented by one of following StringIO, File, Tempfile Is it all? Or can it be represented by also other class? I need to know this because i have my own validation of file kind and when is mime type invalid then i want to put msg to record.errors and i also want to dont upload this file in next step by my upload method so i call...
2008 Mar 18
0
no marshal_dump is defined for class StringIO
Hi all, I''m newbie to ROR, anybody know why I would be getting the following error when I use paginating_find with memcache "no marshal_dump is defined for class StringIO" Im just using the plugin straight out with very default options like from the documentation. Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "R...
2006 May 29
3
File.size() on Uploaded Images Fail
...upload. def newfile=(newfile_field) self.filename = base_part_of(newfile_field.original_filename) self.filetype = newfile_field.content_type.chomp self.filesize = File.size(newfile_field) ### It fails on this line for images... end The error I get is: "can''t convert StringIO into String" I''m sure there''s an easier method/property to get the file size of the uploaded file. Like, reading the HTTP headers? How do they get the file size in the validator? validates_filesize_of :field, :in => 15.kilobytes..1.megabyte Thanks for any leads, Jeff -...
2006 Aug 17
3
file_column do download from URL
...oo.se/articles/2006/01/09/file_column-magick-and-versions require ''open-uri'' Attachment.find_first.filename = open(url) if not working as expected... what is interesting is that: >> @a = open(''http://www.google.com/intl/pl_ALL/images/logo.gif'') => #<StringIO:0x3c22390> >> @a = open(''http://research.microsoft.com/~dcr/art/lamps/collage/P0002190.JPG'') => #<File:C:/DOCUME~1/VALUED~1/LOCALS~1/Temp/open-uri356.2> smaller files return StringIO larger - File (Tempfile to be specific) Any hints? -- Posted via http://www....
2006 Jan 05
4
testing file uploads
Hi all, I was wondering about the class used when rails receives file uploads. Sometimes it appears to be a File, and other times it is a StringIO. Also it has methods such as original_filename that don''t appear to belong to either of these classes. I ask because I''m trying to work out how to test my fil upload related models and controllers. Is there some standardised way of creating a file upload mock object? Many thanks...
2007 Apr 27
3
Image upload problem.
I''ve seen posts of a few people who have this problem, but not a single response about solving it. I can''t upload .png files, but .jpg and .gif work fine. When I upload just a .png, my action gets a StringIO object which breaks when I try to copy the upload to an absolute location. However, using multiple-field upload, as long as one of the to-upload files is *not* a .png, all of the png files will properly upload (TempFile objects now). So: Upload: test_image.png --> Failure (FileUtils evaluating...
2006 May 04
3
File Upload problem when file is small, under 19k(read method returns nothing)
Hi I hope someone can shed some light on this have searched a lot but found nothing definite. This happens on Ubuntu and Fedora 2. I am having a problem with uploading small files (images gif or jpeg under 19k). According to ruby documentation these are stored temporarily as StringIO objects rather than temporary files (as is done 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 ove...
2007 Dec 17
3
not able to view the images after the upload
...uot;=>"create", "controller"=>"upload", "entry"=>{"lon"=>"77.620006105957", "name"=>"hebbal", "comments"=>"test", "image_temp"=>"", "image"=>#<StringIO:0xb74d72d8>, "lat"=>"13.0509805297852"}} Rendering upload/list.rjs Completed in 0.03459 (28 reqs/sec) | Rendering: 0.00003 (0%) | DB: 0.00000 (0%) | 200 OK [http://mongrel_cluster_civic/civic/upload/create?iframe_remote=true] The image is shown as as STRINGIO insted of s...
2006 Jun 07
5
File is nil
...9;'t expect it! The error occured while evaluating nil.original_filename #{RAILS_ROOT}/app/models/logfile.rb:9:in `file='' #{RAILS_ROOT}/app/controllers/logfile_controller.rb:31:in `create'' Request Parameters: {"logfile"=> {"fileName"=>#<StringIO:0x39c3fc0>}, "commit"=>"Create"} This is the code in view: <%= form_tag({:action => ''simple_save''}, {:method => "post", :multipart => true}) %> <input type="file" name="...
2006 Feb 12
0
problem serving files which start with newlines
...is exactly the newlines missing). To reproduce this place something like this an a controller def foo send_data "\nline1\nline2|" end and the downloaded file will contain only "line1\nline2|". I think I tracked the problem down to webrick_server.rb around line 115. A StringIO object is created, filled with the data and then this is split into header and body by calling ''extract_header_and_body''. Before this call the newlines are still there and after it they are missing. ''extract_header_and_body'' uses ''*data.split(/^[\xd\x...
2006 Jan 12
3
VCard Upload Import
...import functionality and I keep getting the following using the code provided below. I''m using the VPIM library to decode the vcards and add them to my database table. Can someone help me out, or point me in a different direction for importing VCards. Thanks. Error: cannot convert StringIO into String Controller Code: require ''vpim/vcard'' if request.post? and params[:import_file] cards = Vpim::Vcard.decode(File.open(params[:import_file])) end