Displaying 20 results from an estimated 127 matches for "file_field".
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 sa...
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
2006 Mar 29
1
Posting multiple files - how to set up params correctly
All,
I have a page where I am allowing the user to specify multiple image
files that are related to one HTML document.
I want to end up with an array of image files that I can then assign
into an array within the controller.
I''m trying to set up my file_field correctly but am having trouble.
I''m not clear on how "the multiple input tags with the same name turning
into an array of parameters" thing works?
I''ve tried:
<%= file_field(''document'', ''image[]'') %>
<%= 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 cod...
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 ''datafile'...
2006 Jul 28
1
How do I get an original file name from an upload using file_field?
...=> ''update_charges''
end
In the view:
<h2>Import CSV file</h2>
<%= start_form_tag( { :action => ''upload'' }, { :multipart => true } ) %>
<label for="document_file">Select .CSV file</label><br/>
<%= file_field ''document'', ''file'' %>
<%= submit_tag ''Upload'' %>
<%= end_form_tag %>
--
View this message in context: http://www.nabble.com/How-do-I-get-an-original-file-name-from-an-upload-using-file_field--tf2014085.html#a5535405
Sent f...
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 is the right hash from radrails:
"upload"=>
"C:\\Documents and Settings\\All Users\\Documenti\\Web...
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,...
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 paperclip attachment called collateral, and a double
polymorphic relation with container (which can be...
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 browse click
only.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~--...
2006 Jul 18
0
how to ensure that a file has been selected on a file_field?
Does anyone know how to validate if a file has been selected using a
file_field control?
I want to ensure a file has been selected before the associated action
is selected.
Presumably something like validates_presence_of something ?
Any pointers most appreciated...
John
--
Posted via http://www.ruby-forum.com/.
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.
2008 Jul 14
1
about string error for upload file in rails 2.1
...erver 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>
<%end-%>
#############################
In a model:
class User < ActiveRecord::Base
validates_format_of :photo,:with=>%r{\.(jpg|png|gif)$}i,
:message=>"图片格式不正确"
def file=(file_field)
File.open("...
2006 Apr 05
6
How to Upload Image through RoR??
Hi,
I have one form , in which I am using file_field teg for input image
file as follows.
=====
<%= file_field("store", "picture") %>
=======
Tha Actual fileld name of my Image field in Database is "store_photo"
with datatype LargeBLOB.
& Inside my Store Model I have specified "def picture" as follo...
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
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class
attribute and array:
(field_helpers -
[:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each
do |selector|
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to rubyonrail...
2007 Sep 30
2
Outputing to the browser, how?
Hello,
I''m writting some helper methods to write forms, so I have this working code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
["file_field", "password_field", "text_field"].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label, label.to_s.humanize)) +
@template.content_tag(:td, super))
end...
2006 Apr 01
0
Many file fields w/same name don''t show up as params array
All,
I have a page where I am allowing the user to specify multiple image
files that are related to one HTML document.
I''m trying to set up my file_field correctly but am having trouble.
I''m trying to post into an array of images that belongs to a document.
I''ve tried:
<%= file_field(''document'', ''image[]'') %>
<%= file_field(''document[]'', ''image[]'')...
2006 Mar 06
1
Uploaded File to Database
...couln''d find anything on the internet.
Now when I want to save the file data to the mysql database, rails gives
me an error.
My code is the same as written in the book on page 363.
Here is my code of the model:
class Document < ActiveRecord::Base
has_many :comments
def file=(file_field)
self.filename = base_part_of(file_field.original_filename)
self.content_type = file_field.content_type.chomp
self.data = file_field.read
end
def base_part_of(file_name)
name = File.basename(file_name)
name.gsub(/[^\w._-]/, '''')
end
end...
2011 Oct 05
2
formtastic / activeadmin
Newbie question:
want to following code to migrate to formtastic:
<% f.fields_for :assets do |asset_fields| %>
<% if asset_fields.object.new_record? %>
<p>
<%= asset_fields.file_field :asset %>
</p>
<% end %>
<% end %>
tried this:
f.inputs "Appartment Details" do
f.input :assets do |asset_fields|
asset_fields.file_field.input :asset, :as => :file
end
end
there is no upload button available. What i am doing wrong?
G...