Hello everyone,
being new to ruby and CGI scripting I’m having some trouble writing an
upload script. Maybe someone can give me a few pointers.
I have a working .rbx that goes like this:
cgi = CGI.new
file = cgi[‘file’]
cp -v #{file[0].local_path.untaint} \ /targetdirectory/#{file[0].original_filename.untaint }
Problems:
-
I don’t like using `` without a good reason,
how do I do this the ruby way ?
-
What I’d really like is a script that would be able to upload
several files at once.
I’ve heard this is not an easy task; suggestions ?
-
Is there a way to have apache write the file straight to the target
directory so I don’t have to make a copy at all ?
Thank you for your time,
Simon
PS: If you are concerned about security problems in my script: it is only
meant to be used by me inside my private network.
···
–
In the first place, God made idiots; this was for practice; then he made
school boards.
– Mark Twain
Hello everyone,
Hi
- I don’t like using `` without a good reason,
how do I do this the ruby way ?
maybe you’re looking for
system(“command here”)
?
or do you want avoid using system’s cp?
in that case you could use ftools to move, copy and so on.
(I discovered ftools.rb imn this list little time ago, and I loved it

- What I’d really like is a script that would be able to upload
several files at once.
I’ve heard this is not an easy task; suggestions ?
I think you can easily get via several values, and iterate
through them, or am I missing the point?
···
On Sat, 21 Dec 2002 20:06:44 GMT, “Vandemoortele Simon” delirious_nospamplz@atchoo.be wrote:
I presume you are using a form something lke this:
<form enctype="multipart/form-data" action="foo.rbx" method="post">
<input name="file" type="file">
<br><input type="submit">
</form>
You should be able to have multiple uploads just by having multiple input
fields with name="file1", name="file2" etc (all with type="file"). Have you
tried it?
···
On Sun, Dec 22, 2002 at 05:24:33AM +0900, Vandemoortele Simon wrote:
being new to ruby _and_ CGI scripting I'm having some trouble writing an
upload script. Maybe someone can give me a few pointers.
I have a _working .rbx_ that goes like this:
cgi = CGI.new
file = cgi['file']
`cp -v #{file[0].local_path.untaint} \
/targetdirectory/#{file[0].original_filename.untaint }`