What would make file upload handling fail to save the files to the /tmp directory? Trying to upload multiple files per request.
controller/action params appear to reflect the right file names and contain /tmp paths for each, but the files are non-existent, nothing in the /tmp folder for them.
#<ActionController::Parameters {“files0”=>#<ActionDispatch::Http::UploadedFile:0x00007f4f12011630 @tempfile=#<Tempfile:/tmp/RackMultipart20250325-
21867-jm9fsv.txt>, @original_filename=“my-dog-file.txt”, @content_type=“text/plain”, @headers=“Content-Disposition: form-data; name="files0"; filename="my-dog-file.txt"\r\nContent-Type: text/plain\r\n”>, “files1”=>#<ActionDispatch::Http::UploadedFile:0x00007f4f120115e0 @tempfile=#Tempfile:/tmp/RackMultipart20250325-21867-5u7syw.txt, @original_filename=“my-cat-file.txt”, @content_type=“text/plain”, @headers=“Content-Disposition: form-data; name="files1"; filename="my-cat-file.txt"\r\nContent-Type: text/plain\r\n”>, “authenticity_token”=>“…”, “action”=>“…”, “controller”=>“…”} permitted: true>
Is there a rails config switch to allow them to actually be written to the /tmp folder? or something of the sort…
No explicit errors; silent failure.
Rails 6.1.7
On the client side, when I change my ajax client code from “contentType: false” to "contentType: ‘multipart/form-data’ ", the server receives file content wrapped in a browser-specific way. Firefox adds “geckoformboundary393dbbfd2ff58c2d4ad5c826226c0f21” to mark the beginning of each file.
The "/tmp/RackMultipart* " are no longer there … I am assuming that type of upload is not intended to save the files in the /tmp folder.
#<ActionController::Parameters {“------geckoformboundary393dbbfd2ff58c2d4ad5c826226c0f21\r\nContent-Disposition: form-data; name”=>“"files0"; filename="my-dog-file.txt"\r\nContent-Type: text/plain\r\n\r\nwoof!!\r\n------geckoformboundary393dbbfd2ff58c2d4ad5c826226c0f21\r\nContent-Disposition: form-data; name="files1"; filename="my-cat-file.txt"\r\nContent-Type: text/plain\r\n\r\nmeow!\r\n\r\n------geckoformboundary393dbbfd2ff58c2d4ad5c826226c0f21–\r\n”, “authenticity_token”=>“…”, “action”=>“…”, “controller”=>“…”} permitted: true>
Note the tiny content “woof!” and “meow!” for each of the files… Bigger file content also shows up in the params. Also, previously, apparently no content was uploaded – one can tell by the long wait with average size text / csv files.
If the other way is not fixable for some reason, what is the best way to parse this alternative type of packaging? Short of devising a DIY parser… (?)