rubyonrailsin

A Ruby and Rails talk

Tuesday, March 9, 2010


[Rails] Re: File Upload - Preserving Original File Name

by rubyonrailsin 0 comments



Share this post:
Design Float
StumbleUpon
Reddit

> Try this:
>
> File.open(File.join(params[:upload_directory],
> params[:file2upload].original_filename),'wb'){ |f|
>   f.write(params[:file2upload].read) }

Yes; but, as I understand your suggestion, that would require me to
pass the original filename as a parameter. What I'm trying to find
out is whether the original filename is somehow available for use as a
part of the file upload mechanism without my having to pass it as a
parameter. If it turns out that it's not available within the file
upload mechanism; then, I can pass it. It's just that I don't want to
go that route if there is an easier way.

Thanks for the input.

... doug

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

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive