ruby - Possible to set file_field to multiple files? -


this question has answer here:

i have file upload input following html:

<input type="file" id="assets" name="assets" multiple="multiple" webkitdirectory="webkitdirectory"> 

i able upload single file so:

single_file = "/users/me/downloads/demo folder/1428441/1.wav" upload = @browser.file_field(:id => 'assets') upload.set single_file 

however, when try upload multiple files, selecting top-level directory (which works if try doing in browser manually):

assets_folder = "/users/me/downloads/demo folder/1428441" puts "does dir exist? #{file.directory?(assets_folder)}" # true  upload = @browser.file_field(:id => 'assets') upload.set assets_folder 

it fails upload @ all. if try creating array containing filepaths of 2 different files:

files = [] files.push("/users/me/downloads/demo folder/1428441/1.wav") files.push("/users/me/downloads/demo folder/1428441/2.wav") upload = @browser.file_field(:id => 'assets') upload.set files 

i see method accepts string parameter: can't convert array string (typeerror)

is @ possible select multiple files via file_field's set method?

if not, other workarounds try? briefly looked @ trying inject javascript apparently that's not possible either, according "how set value file input in html?"

try setting multiple filepaths, seperating them semicolons , see if works(not tested), this:

multiple_file = ("/users/me/downloads/demo folder/1428441/1.wav" ; "/users/me/downloads/demo folder/1428441/some_else.wav") 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -