Forum: Ruby on Rails Upload file without using file_field

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C95664a5c59ccdfb0da2f5910675c62c?d=identicon&s=25 Sudhi Kulkarni (sudhi)
on 2009-03-18 11:59
Hi,

I wanted to have a textbox which would have the file name specified and
on submit in the controller I wanted to save this file on the server
file system. Any pointers would helpful.

Please note I do not want to use file_field since that does not match my
requirement...

My requirement is something like

<input>
upload c:\1.txt
upload c:\2.txt
</input>

Button Submit

On submit upload the 2 files to server

Thanks,
Sudhindra
D2536dbfa799820f207aaa74832a26d5?d=identicon&s=25 James Cowlishaw (Guest)
on 2009-03-18 12:48
(Received via mailing list)
Sudhi
Perhaps you can use hidden file_field and populate it with javascript
from
the text_field?

James.

2009/3/18 Sudhi Kulkarni <rails-mailing-list@andreas-s.net>
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-03-18 13:18
(Received via mailing list)
or you could parse the string inside that text_box and loop through
the several entries.
C95664a5c59ccdfb0da2f5910675c62c?d=identicon&s=25 Sudhi Kulkarni (sudhi)
on 2009-03-18 15:36
MaD wrote:
> or you could parse the string inside that text_box and loop through
> the several entries.

Hi,

Thanks for the inputs, but I am a newbie to ROR. I want to understand
what exactly happens in the background when I use a file_field? Is it
complex to have a file upload working without a file_field(Hidden
atleast)?

Regards,
Sudhindra
6883e5ef03484d4fcef507d7b4f1d243?d=identicon&s=25 Matt Jones (Guest)
on 2009-03-18 18:48
(Received via mailing list)
So the user is typing in filenames directly? If that's the case, what
you're asking is impossible - and for very good reasons. Javascript
can't access client-side files; it can't even serialize file input
tags (thus the issues with AJAX submission of file fields).

--Matt Jones

On Mar 18, 6:59 am, Sudhi Kulkarni <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.