|
@@ -94,15 +94,19 @@ class UploadData < Riddl::Implementation
|
|
|
i = 0
|
|
|
while i < @p.length do
|
|
|
item = @p[i]
|
|
|
+
|
|
|
if(item != nil && item.name == "files[]")
|
|
|
|
|
|
- # puts item.inspect
|
|
|
+ #puts item.inspect
|
|
|
+
|
|
|
+ #get filename from additional info as .filname is not alwys right?
|
|
|
+ readFilename = item.additional.inspect.to_s[/filename=\\"(.*?)\\"/m, 1]
|
|
|
|
|
|
path = File.join(File.dirname(__dir__),'storage/', @r.drop(1).join("/"))
|
|
|
FileUtils.mkdir_p(path)
|
|
|
|
|
|
readFile = File.read(item.value.inspect.to_s[/Tempfile:(.*?)>/m, 1])
|
|
|
- File.open(File.join(path, item.filename), 'wb') do |file|
|
|
|
+ File.open(File.join(path, readFilename), 'wb') do |file|
|
|
|
file.write(readFile.to_s)
|
|
|
end
|
|
|
|