Hi!
Im developing a simple prototype of an application. It fills an oracle
db with data about a file in the filesystem, and save the entire file
in a blob along with some metadata. To get the file in the db i use a
file_field form helper. All goes well with the radrails-integrated
browser, but it doesnt work anymore in firefox. The problem is,
firefox seems to cut the pathname from the file.
Here is the right hash from radrails:
"upload"=>
"C:\\Documents and Settings\\All Users\\Documenti\\Web
Development\\contrattositoweb.pdf",
Here is firefox one:
"upload"=>"contrattositoweb.pdf"
That leads at:
Errno::ENOENT in Documents#create
No such file or directory - contrattositoweb.pdf
The important part of the code is, for the view:
<p><label
for="document_data">Content</label><br/>
<%= file_field ''document'', ''upload''
%></p>
and in the model document.rb:
def upload=(upload_field)
self.filename=upload_field
self.content_type=MIME::Types.type_for(upload_field)
File.open(upload_field, "rb") { |f|
#ERROR HERE
self.filename=File.basename(upload_field)
self.content=f.read
}
end
def base_part_of(file_name)
name=File.basename(file_name)
name.gsub(/[^\w._-]/,'''')
end
As far as i know im not calling any filename-modder in the model, so
maybe the problem is in the view?
Thanks in advance for all helps...
--
Maurizio Marek
idnondisponibile@fastwebnet.it