Displaying 20 results from an estimated 700 matches similar to: "Multiple file uploads - only one file object gets posted"
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
2006 Jul 06
6
Problem with gettext and functional tests
Hi,
I am using gettext to let my web application know several languages. All
works fine, but since I integrated it, my functional tests don''t work any
more.
I keep getting the error message:
NoMethodError: undefined method `cgi'' for
#<ActionController::TestRequest:0xb77f7f88>.
All right, TestRequest doesn''t have a cgi method. Therefore I just included
this into
2006 May 29
3
File.size() on Uploaded Images Fail
I am checking the file size of an uploaded file and storing it in a filesize
column. It will work just fine when the user uploads any files other than
images (jpg,png,gif).
Word, Excel, Powerpoint, .zip and more all work fine.
This is my model asset.rb that handles the file upload.
def newfile=(newfile_field)
self.filename = base_part_of(newfile_field.original_filename)
self.filetype
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
2006 Jun 07
5
File is nil
I don''t understand why my program does not get the file that I try to
upload.
It returns the following error when I try to upload a small file:
NoMethodError in LogfileController#create
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.original_filename
#{RAILS_ROOT}/app/models/logfile.rb:9:in `file=''
2007 Aug 22
8
How to spec an attachment_fu model
First off, I''m not trying to spec attachment_fu, I know it''s been tested.
But, I added some code to that model that I do need to test. Basically,
I need to somehow fulfill the "uploaded_data" property so I can actually
run my tests(otherwise they fail because of validations). The
"uploaded_data" field is what would grab the multipart data from form.
Here
2006 Aug 17
3
file_column do download from URL
Is there a simple way of forcing file_column to download file from given
(ex. in form) url instead of uploading it manualy?
I know:
http://blog.caboo.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 =
2010 Sep 21
0
Upload form with uploadify jquery plugin
I would like to integrate the uploadify plugin with a standard rails
form. However I can''t figure out how to add a new field and have it get
submitted with the file upload. I added a name field into the form, but
the valued does not get submitted.
<%
dialog_file_description = ''Photos''
allowed_extensions = [:jpg, :jpeg, :gif, :png]
max_size = 20.megabyte
2006 Aug 15
8
AGAIN: file object treated as string
I am trying to implement the uploading of a file to a remote server
I get error while trying to write the file on the server. The error I
get is the following:
undefined method `rewind'' for #<String:0x2aaaad062eb8>
It seems to be treating my file as a string instead of a File object.
--------- Code is below ------------------
VIEW:
<%=
2007 Aug 03
6
Problems saving an uploaded image to an app folder
In my app, the user can upload images. Rather than shoving the image
data in the database, i want to put the filename and content type into
the db, then rename the image with its record''s id number, and then save
it into a local folder in my app folder. (hardcoded for now)
All the details are being saved to the db ok, so as far as i know the
"picture_file=" method is fine.
2008 May 28
3
Plug-in support for Camping Apps
# camping_plugin.rb
# plug-in support for Camping Apps
# require ''lib/camping_plugin''
# override R helper method to your liking :-)
module Camping
module PluginHelpers
def R_with_module(c,*g)
p,h=/\(.+?\)/,g.grep(Hash)
g-=h
raise "bad route" unless u = c.urls.find{|x|
break x if x.scan(p).size == g.size &&
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
2006 May 31
4
acts_as_attachment , someone using it?
Hi, i just found the acts_as_attachment plugin for image upload, seems
sogood but i cant find any docs about it, if someone here using it can
give some references or working examples about the plugin that will be
excellent.
So what you wanna rails today?
--
Posted via http://www.ruby-forum.com/.
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
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
2006 Mar 23
1
Multiple file uploads
I have a form with multiple file upload fields (1-10), of which 2-10
are optional. So i need to cycle thru all file fields and pick only
those that have a file attached. Selecting only one file in the form,
the paramters look simple: "image"=>{"file_1"=>#<File:/tmp/CGI344.4>,
"file_2"=>"", "file_3"=>""}, so I
2013 Mar 15
2
Icalendar.Parse(StringIO.new(aString)) complains about missing method, bytesize
I need to send an ics file to a web service, so however it gets there it
will arrive as a string. Is there another way to begin 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
2006 Jun 12
8
Input/output error on linux
Hi,
I''m trying to use mongrel 0.3.13 with Rail 1.0
Believe it or not, on OS/X it works well for weeks at a time. On
linux I''m getting Input/output errors after anything from a few hours
to days, never more than a week. Once they start they don''t stop.
The only pattern I''ve seen is that it always (seems) to happen while
rendering an rhtml file.
2006 Nov 05
1
Testing custom mongrel handlers?
Hey Folks-
I''m trying to setup a new test/spec harness for testing Merb. I was
wondering if there is a way to mock the Mongrel request, response
objects easily to test my handler without actually running a server?
I can easily do the env hash but I''m not entirely sure what needs to
go in the request StringIO object that gets passed into my mongrel
handler''s
2006 Jan 12
3
VCard Upload Import
I''m trying to add Vcard 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