Jump to content

Uploading multiple files at once

Recommended Posts


Hello all, I have been wracking my brain on this for awhile now and have no idea what I need to do to accomplish Uploading multiple files in a single upload.

I am using java and Autoit to automate a website. 

My Autoit Script is - 

ControlFocus("File Upload","","Edit1")
ControlSetText("File Upload","","Edit1",$CmdLine[1])
ControlClick("File Upload","","Button1")


My java code related to this - 

System.out.println("Setting up image String");
for (int imagenum1 = 0; imagenum1 < images.size(); imagenum1++)
    String imagetoadd = images.get(imagenum1);
    if(imagenum1 < images.size()-1) //Loop through each Image in the array list and combine them into one string
        allimages = allimages + imagetoadd + " ";
        allimages = allimages + imagetoadd;
    System.out.println("All data info has been added: " + allimages);
} // All data will be in the following format - "C:\File1location.jpg" "C:\File2location.jpg"
//Add Quotation marks in so Autoit can pass it through..
allimages = "\""+allimages; // Add " before allimages so it would be in the following format - ""C:\File1location.jpg" "C:\File2location.jpg"
allimages = allimages + "\""; //Add " after allimages so it would be in the following format - ""C:\File1location.jpg" "C:\File2location.jpg""
System.out.println("Image String: " + allimages);

Runtime.getRuntime().exec(autotitdir +" " + allimages); //upload image in format of "C:\File1location.jpg" "C:\File2location.jpg"

I have read on many threads that a single or double quote can be used.  but for some reason it is still not working in the file upload window. When I paste in "C:\File1location.jpg" "C:\File2location.jpg" into an upload window it uploads both images.. Can someone point me in the right direction? 





Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now