Opening a multipart / form-data ZIP file with rubyzip

advertisements

I want to extract the files within a ZIP file I uploaded to my Rails app. The files within the ZIP file are going to be stored in the database.

I want to open the ZIP file in my action, without first having to save the file to a folder - I want to open the multipart/form-data stream with rubyzip.

It looks like rubyzip's ZipFile.open only takes a filename - not an IO stream.

What do I need to change within rubyzip, to allow me to open the zip file as a stream, like this:

Zip::ZipFile.open(params["zip_file"]) do |zip_file|
 ...
end

Thanks. Joerg


Using

Zip::ZipFile.open(params["zip_file"].path) do |zip_file|
 ...
end

should work.