One way would be to just process the uploaded-file data from the
request as needed and not worry about saving or doing anything else
with the tmp-saved uploaded-file itself, something like:

### in ./app/models/uploadable_file.rb
class UploadableFile

  ### for use in testing:

  def initialize(fname, contents)
    @fname = fname
    @contents = contents
  end

  def original_filename
    return @fname
  end

  def read
    return @contents
  end

  ### class meths:

  def self.parse(upfile)
    return nil if upfile.blank? or not (upfile.respond_to?
('original_filename')\
 and upfile.respond_to?('read'))

    orig_fname = upfile.original_filename
    contents = upfile.read
    # parse/process contents ....
  end
end

Then just call that class meth in your controller to parse the
uploaded file for an example file form element of name "upfile":

   ### in some controller meth that handles that multipart/form-data
form:
   ...
   parsed_contents = UploadableFile.parse(params[:upfile])
   # check results ....

Jeff

On Mar 22, 9:37 pm, GoodGets <goodg...@gmail.com> wrote:
> parsing the file's not the problem, just not sure what to do with it
> before or after.  I was thinking about uploading the files using
> Paperclip, parsing it, then deleting itfrom the database.  But, that
> all seems a little unnecessary, especially if I don't care if they are
> even saved.
>
> I then thought about grabbing them from the temp directory, but
> honestly wasn't sure how to go about doing that.  So before I really
> delve into the Tempfile, should I even worry about it in the first
> place?  Each user uploaded file will be like 30kb max, and I'll only
> be processing a couple hundred a month.  Also, I'm hosted on heroku,
> so the s3 transfers (if I do save the file) will be free.  What ya
> think?
>
> Any advice really is appreciated

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to