search for: incoming_file

Displaying 5 results from an estimated 5 matches for "incoming_file".

2006 Jan 09
1
Saving an upload
...destfile = "#{upload_dir}/#{filename}" p destfile logger.debug "saving ''#{destfile}''" FileUtils.copy @temp_file.local_path, destfile #assert File.exists?(destfile), "File upload failed" end end def uploaded_file=(incoming_file) self.filename = incoming_file.original_filename self.content_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_nam...
2006 Jun 28
0
Reading email attachments
...reating attachment'' attachment = Attachment.new attachment.uploaded_file( email_attachment, attachment ) c.attachments << attachment if attachment.save c.save end end Attachment#uploaded file looks like this def uploaded_file( incoming_file, attachable ) self.filename = incoming_file.original_filename self.content_type = incoming_file.content_type dir = "#{RAILS_ROOT}/attachments/#{attachable.type}/#{attachable.id}" Dir.mkdir( dir ) unless File.exists?( dir ) self.path = "#{dir}/#{self.filename}&quo...
2007 Apr 17
0
rflickr: invalid auth token when uploading
.../plugins/rflickr-2006.02.01/lib/flickr/upload.rb:70:in `error'' /vendor/plugins/rflickr-2006.02.01/lib/flickr/upload.rb:179:in `upload_image'' Any insight into this error will be greatly appreciated. Here is the action that gets executed on an upload request: def upload incoming_file = params[''flickr_image''] content_type = incoming_file.content_type.chomp msg_out = nil responds_to_parent do render :update do |page| if content_type.rindex(/image\/[(jpe?g)||(gif)||(png)]/) cache_file = "#{RAILS_ROOT}/public/cache/flickr....
2006 Mar 23
1
Multiple file uploads
...ached. Selecting only one file in the form, the paramters look simple: "image"=>{"file_1"=>#<File:/tmp/CGI344.4>, "file_2"=>"", "file_3"=>""}, so I tried this: params[:image].each_value do |incomming_file| unless incoming_file.empty? #do file processing end end However, this is still causing the empty fields (file_2, file_3 etc) to be processed, which raises all sorts of errors as the File.methods are not available of course. I tried .nil? and various other tests but i simply can''t get it to skip tho...
2009 Jul 29
0
Problem uploading file to database mysql blob field
...wn drop_column :"attachments", :"file" end 2. Now I should change the model code to copy the file content into the blob. I updated attachment.rb , just added the line self.file = @temp_file.read as I need to read the content of file and put it into database. def file=(incoming_file) unless incoming_file.nil? @temp_file = incoming_file if @temp_file.size > 0 self.filename = sanitize_filename(@temp_file.original_filename) self.disk_filename = Attachment.disk_filename(filename) self.content_type = @temp_file.content_type.to_s.chomp self.filesize = @temp_file.size self.file =...