1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

SelfService: Improve file upload so it doesn't eat up RAM.

This commit is contained in:
Hector Sanjuan 2012-01-12 16:31:14 +01:00 committed by Ruben S. Montero
parent 7e1653044f
commit b329de02da

View File

@ -50,6 +50,7 @@ require 'sinatra'
require 'yaml'
require 'erb'
require 'tempfile'
require 'fileutils'
require 'json'
require 'OCCIServer'
@ -349,9 +350,8 @@ end
post '/ui/upload' do
file = Tempfile.new('uploaded_image')
FileUtils.cp(request.env['rack.input'].path,file.path)
request.params['file'] = file.path #so we can re-use occi post_storage()
file.write(request.env['rack.input'].read)
#file.close # this would allow that file is garbage-collected
result,rc = @occi_server.post_storage(request)
treat_response(result,rc)
end