search for: just_filename

Displaying 4 results from an estimated 4 matches for "just_filename".

Did you mean: dest_filename
2006 Jan 09
1
Saving an upload
...ntent_type = incoming_file.content_type @temp_file = incoming_file end def filename=(new_file_name) write_attribute("filename", sanitize_filename(new_file_name)) end private def sanitize_filename(file_name) # get only the filename, not the whole path (from IE) just_filename = File.basename(file_name) # replace all non-alphanumeric, underscore or periods with underscores just_filename.gsub(/[^\w\.\-]/,''_'') end end films_controller.rb: class Admin::FilmsController < ApplicationController ... def create @film = Film.new(params[:f...
2006 May 02
0
Validation in File Upload
..._filename) self.filename = Time.now.strftime("%H%M%S")+self.filename #self.data = element_field.read File.open("#{RAILS_ROOT}/public/newsletters/#{self.filename}","wb") { |f| f.write(newsletter_field.read)} end private def sanitize_filename(value) just_filename = value.gsub(/^.*(\\|\/)/, '''') @filename = just_filename.gsub(/[^\w\.\-]/,''_'') end end --VIEW-- <h3>Add a New Newsletter</h3> <%= form_tag({:action=>''add_newsletter''}, :multipart=>true) %> <table> <tr&...
2006 Jan 06
4
Upload Progress Bar Problems
I''m writing an application where the user will be uploading many images and user feedback is essential. I''ve been trying to get the upload progress bar plug-in to work, but thus far have not had any success. I''ve downloaded Sean Treadway''s application code from his site http://sean.treadway.info/demo/upload/ and I followed the steps in his Upload
2006 Mar 29
7
Uploading files and writing them to server?
Where should I look for information on how to use Rails and Ruby to accept the upload of a file and then to save that file to the file system of my server? I''m reading the "Uploading a file" section of Agile Web Dev with Rails, but it''s geared toward saving the file in the database. Any advice? Thanks, Jeff -- Posted via http://www.ruby-forum.com/.