# Can \[ruby\] on rails do this --- crazy request

**URL:** <https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636>\
**Category:** Rails\
**Created:** [March 21, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636 "2007-03-21T19:14:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 21, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/1 "2007-03-21T19:14:31Z")

</div>

Hi all,

Loving the Ruby on Rails world so far.

My web app needs to browse the local file system for file names and  
directories to build lists for processing with a commercial application.  
I realize this is a no no for web client apps due to security concerns.  
One approach is to write signed java applets to integrate this  
functionality. While this would work, I was curious if it is possible to  
make a signed piece of ruby code to do the same thing?

The code could be RJS based and signed. Is there any way to make this  
happen and keep out of the java world? Is jruby a possibility?

Thanks any help is greatly appreciated,  
Rick

---

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 21, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/2 "2007-03-21T20:45:31Z")

</div>

Rails has nothing to do with this (being the server and all, no  
interaction  
with client computers). Java applets work because they are run on the  
client. Javascript is not allowed to do much in this space, last I  
checked,  
so you’re basically stuck with a Flash or Java app embedded in the page  
that  
can post back to the server.

Jason

---

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 22, 2007, 4:23am UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/3 "2007-03-22T04:23:21Z")

</div>

I do know that Flash 8+ has an upload window but I’m not sure if it  
can scour the drive to list all the files. You may want to check that  
out. If not, then the java applet is the answer for you.

On 3/22/07, Rick F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> make a signed piece of ruby code to do the same thing?
> 
> The code could be RJS based and signed. Is there any way to make this  
> happen and keep out of the java world? Is jruby a possibility?
> 
> Thanks any help is greatly appreciated,  
> Rick

–  
Ramon Miguel M. Tayag

---

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 22, 2007, 10:42pm UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/4 "2007-03-22T22:42:42Z")

</div>

Have you looked at the Ruby shell library? It is part of the standard  
installation. On Linux you’ll find it at  
/usr/lib/ruby/1.8/shell

You can look up the Shell class and its methods at  
[http://www.ruby-doc.org/core/](http://www.ruby-doc.org/core/)

You can do anything you’d from the command line and pass values back and  
forth.  
You can write your own classes and put the file in the RAILS\_ROOT/lib  
dir.

I am using it to do some file format conversions. To see how shell is  
used you can look into the doc\_convert library to see how shell is  
used. That’s what I did.  
[http://raa.ruby-lang.org/project/doc\_convert/](http://raa.ruby-lang.org/project/doc_convert/)

Hope this helps,

bakki

---

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 23, 2007, 1:58am UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/5 "2007-03-23T01:58:00Z")

</div>

Rick F. wrote:

> Hi all,
> 
> Loving the Ruby on Rails world so far.
> 
> My web app needs to browse the local file system for file names and  
> directories to build lists for processing with a commercial application.  
> I realize this is a no no for web client apps due to security concerns.  
> One approach is to write signed java applets to integrate this  
> functionality. While this would work, I was curious if it is possible to  
> make a signed piece of ruby code to do the same thing?
> 
> The code could be RJS based and signed. Is there any way to make this  
> happen and keep out of the java world? Is jruby a possibility?
> 
> Thanks any help is greatly appreciated,  
> Rick

When you said your web app needs to browse the local file system, does  
it means the file system of the web server or does it means the file  
system of the people browsing/access your web page? If it is the  
former, it is simple using the File Class. If it is the later, I am not  
sure. If it is file upload, you can use the file\_field\_tag.

On the other hand, if you can run application on the client end, then  
you can build one with ruby that look up the workstation’s file system  
and send appropriate messages to the server (with backgroundrb?)

---

<div class="post-metadata">

**Author:** ![rickf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9e8a1a/32.png) [@rickf](https://www.ruby-forum.com/u/rickf)\
**Post date:** [March 23, 2007, 1:13pm UTC](https://www.ruby-forum.com/t/can-ruby-on-rails-do-this-crazy-request/89636/6 "2007-03-23T13:13:13Z")

</div>

> When you said your web app needs to browse the local file system, does  
> it means the file system of the web server or does it means the file  
> system of the people browsing/access your web page?

Sorry if I wasn’t clear. The file browsing would be on the client end in  
the web browser. The user will need to specify lists of files and  
directories for processing by the main application.

Although I have seen people do tricks with the file upload, this is a  
little clunky for my needs.

Thanks for all the possibilities.
