similar to: how to ensure that a file has been selected on a file_field?

Displaying 20 results from an estimated 70000 matches similar to: "how to ensure that a file has been selected on a file_field?"

2006 Jan 22
1
file_field questions
A couple questions about file_field elements. First, with code such as this: <%= file_field ''attachments'', ''filename'' %> Would the filename of the file I select be the value that''s stored within the database under the "filename" column, and then I would just add in code in my "create" controller to upload the actual file?
2006 Jul 28
1
How do I get an original file name from an upload using file_field?
I am uploading a .csv file for importing into a database; however, this file does not need to be saved on the server. How do I get the file name of the original file? I know about the file_column plugin but I don''t need/want to save the uploaded file on the server, I just need to import it and delete it. Right now the file name get returned as some random temp file name... there has to be
2010 Sep 20
0
file_field
At: http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm You can find: <%= file_field ''upload'', ''datafile'' %> I saw the file_field documentation from here: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-file_field But, still cannot get how the parameters ''upload'' and
2006 Feb 06
2
File_field and Firefox
Hi! Im developing a simple prototype of an application. It fills an oracle db with data about a file in the filesystem, and save the entire file in a blob along with some metadata. To get the file in the db i use a file_field form helper. All goes well with the radrails-integrated browser, but it doesnt work anymore in firefox. The problem is, firefox seems to cut the pathname from the file. Here
2009 Feb 11
0
remote_form_for file_field strangeness
Does anyone see any problem with this form? - form_remote_for(Photo.new, :html => {:multipart => true, :target => :uploader}) do |f| .form_element = f.label :photo = f.file_field :collateral = hidden_field_tag :container_id, @shoot.id = hidden_field_tag :container_type, @shoot.class.name .form_element = f.submit ''Add Photos'' The photo has a
2005 Nov 17
1
original filename doesn't display in file_field
In my item upload view I have: <%= file_field ''item'', ''file'' %> and in my Item model: def file @file #@file.original_filename # <- also tried this end def file=(file) @file=file end And if the upload bails because of errors (and renders the same page), all other fields (text_field, text_area, etc.) retain their inputted values, but the file
2009 Oct 20
5
Annoying problem with file_field and paperclip
Hi all, I have a really really annoying problem that''s driving me nuts with file_field and paperclip and having to upload images everytime a form is edited even though the user is quite happy with the currently uploaded image or loose the previously uploaded image. This seems to be caused by the rails file_field helper not storing the data that has been read in from the db in the same
2006 Jul 26
5
code for uploading files to the filesystem instead of db
Does anyone have any standard code for uploading files to the filesystem? I''ve got code already for uploading images to the database but I''d prefer to store the files on the filesystem. In particular I need to know how to (a) ensure a file has been selected in the file_field (b) how to extract the filename from the file_field (c) how to actually move the file from client to
2006 Apr 30
0
ActionMAiler and file_field Question
Hi Gang, I''m trying to figure a way to set an attachment to an email by allowing the user to browse for a file to send with the mail. I thought that I could use file_field to do this - but having no luck. HAs anybody got a working example of how to achieve this? Or is it the wrong way to go? TIA, Eric.
2006 Jan 15
4
file_field vs. file_field_tag
Hi, The documentation doesn''t make it clear why both file_field and file_field_tag are both useful. What is the reason for having two instead of just one of these? Thanks, Peter
2008 Jun 19
2
Non editable file_field
Hi, I need to upload files in my application I am using following code <tr> <td width="125">Upload Document:</td><td width="400"><%= form.file_field("filename") %></td> </tr> But I want that the file field that gets displayed in my browser should not be editable. i.e user should be able to select the file through the
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all, I''m fairly new to rails so I''m probably doing something really stupid here.... I have been banging my head at this for hrs now... I''ve tried so many different things and nothing seems to get me any further... I am trying to create an image uploading page that will simultaneously create thumbnails to separate file directories and update the database via
2006 May 02
0
Validation in File Upload
I have an app whose admin allows users to upload PDFs to populate a "newsletter" section. I''m having trouble getting validation to work properly. I want to be sure that a name, description & file are specified in the form. The app seems to catch the error and won''t write a row to the DB but it will create a file sized 0KB in the upload folder and it
2006 Feb 05
0
validating presence of file uploads
not sure whats going on here, but I''m using some pretty standard code to manage file uploads in to a db, but having trouble detecting if the file upload field has been filled or not. in my Asset Model, I have: def asset=(asset_field) self.name = base_part_of(asset_field.original_filename) self.content_type = asset_field.content_type.chomp self.data = asset_field.read end def
2005 Oct 17
0
acts_as_taggable and per-user tags
I''m trying to add per-user tags to a simple app built atop the tiny_file example code, as follows: ------------------------------------------------------------------------------------------------- sqlite> .schema CREATE TABLE resources ( id INTEGER PRIMARY KEY, filename VARCHAR(255), user_id integer ); CREATE TABLE ''tags'' ( ''id'' INTEGER
2007 Mar 14
9
file_field doesnt work inside form_remote_for
When I do file_field within a form_for things are fine... but within a form_remote_for, with nothing else changed, I find that the params does not even have the element document[uploaded_file] even though it is definitely present in the HTML source in the form. Obviously the file upload fails. Am I missing something? Or has someone else faced this? Or is this a known bug? Rajesh
2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign key? The problem is, I can''t check if the attribute is a valid foreign key if the attribute doesn''t even exist. For example, every employee must be in a department. In the following code, if an employee''s department_id is not present then Department.find_by_id(department_id) might cause
2007 Jun 21
1
Validation Through Multiple Models from one Form
Hey All, I have a form that submits data to multiple models. I have class Man < ActiveRecord::Base has_many :notes has_many :contacts validates_associated :contacts, :notes validates_presence_of :first_name validates_presence_of :last_name class Contact < ActiveRecord::Base belongs_to :man validates_presence_of :contact_info class Note < ActiveRecord::Base
2008 Jul 14
1
about string error for upload file in rails 2.1
hello: I have code for upload image file to server file system.This works in rails 1.2.3.But in rails 2.1,it gets an error. The following is the important code: In a view: <%form_for :user,:url=>{:action=>"register"},:html=>{:multipart=>true} do |f|-%> <p> <label>照片</label> <%=f.file_field "file"-%> </p>
2006 Dec 15
0
Help with file_field
I''m new to ruby and rails, so sorry if this is a simple question. I''ve found lots of examples that demonstrate uploading pictures, but I need something simpler. Could someone post a simple example of uploading a text file, saving the file in an object and then "puts" the object text. I''m really getting lost in two steps: 1. How to get from file name to