similar to: uploading an image to a Rails app

Displaying 20 results from an estimated 3000 matches similar to: "uploading an image to a Rails app"

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 Jan 09
3
rails ignoring the migration file
I have a mysql database that I am trying to use migrations on. The problem that I am having is that when I create a blob field in my migration file like so: t.column "data", :binary, :limit => 15.megabytes, :null => false rails changes it to this in the schema: t.column "data", :binary, :default => "", :null => false not only is this not what I wanted
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?
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
2006 May 09
2
handling file upload onto local filesystem.
Hi, I have a multipart form upload field uploaded through <%= file_field("profile", "profile") %> Once a submit happens, the action basically does something like: profile = Profile.new(params["picture"]) This invokes the models = to method: def picture=(picture_field) ...do a bunch of assignments here end def validate ... do a bunch of validations
2006 Jan 09
4
How to carry parameters to a new page?
Hello, I have a page where user can register him/herself to the site. If the user enters something wrong, or leaves blank textboxes, I want to reload the page and tell the user what went wrong. Also the textbox-values the user already entered, should be kept in the textboxes. For example, in my user-controller: if @username.length == 0 redirect_to :action =>
2006 Jun 16
4
Depot App: Upload Images
Hello, I''m a newbie to Ruby on Rails and like many others, I have been working through the depot application in the Agile Web Development book. I was wondering if anyone had enhanced the depot application to include the upload of images for each product? The following describes the sort of thing that I have been asked to produce for a client, so apologies if the information is not
2005 Dec 04
2
Filecolumn: url_for_file_column problem
Calling url_for_file_colum results in a TypeError: can''t convert nil to string. The error is in line 148 of filecolumn.rb: def relative_path(subdir=nil) File.join(relative_path_prefix,subdir, @filename) end If I substitute '''' for subdir in the File.join command, then it seems to work fine. Since this is a plugin, I''m wondering why I need
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 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
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 Apr 26
3
re-sizing pictures.....
So i followed the steps in the agile development book and everything is working just fine... i even added a few new functions to list and manage the pics. but what if i start uploading big pics? i don''t want to have huge desk-top size pics taking up the whole page all the time. right? so does anyone have a sort-of thumbnail thing they''d be willing to share? any help would
2006 Nov 28
34
Uploading Large (100mb+) files
I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does not have mongrel installed. It does proxy requests to several other mongrel-only servers (each running 2 mongrel processes). Each mongrel node has the same rails code-base and it''s working perfectly. However, my question is when I add an upload file form... where is it going to physically put that file? I mean since
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 follows:- ========================= def
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,
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>
2005 Dec 23
1
Handling file uploads & mixing class and instance vars
Hey Everybody, This is the only way I''ve been able to get my file upload to work: class Item < ActiveRecord::Base def file=(upload) @file=upload end def after_create File.open("public/items/#{self.id}.jpg", "w") { |f| f.write(@file.read) } end end The upload form has "file_field ''item'', ''file'',
2006 Jan 09
6
Rendering dynamic Gruff image (send_data)
Dears, Got a controller witch do a send_data for displaying a chart. like : send_data(g.to_blob, :filename => "any.png", :type => ''image/png'', :disposition=> ''inline'') I actually do a <img src="http://myhost:3000/stats/make_graph" /> Is there any way more clean to do that ? At minima don''t hardcode the beginning
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|
2006 Jan 18
5
Exception not caught?
Hello all. I have started reading up on exceptions and tried replacing a manual check with one. Given the following code: def results begin @componentlogs = Componentlog.find(:all, :conditions => [ "cl_compname = ?", params[:componentlog][:cl_compname].strip] ) rescue ActiveRecord::RecordNotFound render_text "<p class=''center''>No