On Mon, 2003-06-23 at 19:36, George Moschovitis wrote:
Hello everybody,
I am wondering if anyone can help me with implementing a file-upload
script using Apache2.0 and modruby1.1.1
lets say I have a form like this
what code should i use in upload.rb to grabe the filedata + filename
from the apache/modruby request. I want to save the file in a custom
directory.
This is for apache 1.3.x not sure about 2 though:
require ‘cgi’
cgi = CGI.new() # New CGI object
myfile = cgi.params[‘myfile’].first.path
myfile is the file name which you can sue for File.new(myfile)
you might have to look at the http.conf
...
RubySafeLevel 0
...
in particular RubySafeLevel if you run into permission
errors/exceptions.
You should consider not lowering your safe level as there could be lots
of exploits in any file handling code if you are not very careful. I
recommend at least safe level 1 and 2 wouldn’t hurt either if you have
world writable locations…