Sign in to follow this  
Followers 0
Wolfiesaxah

How to script file upload button

6 posts in this topic

#1 ·  Posted (edited)

<input type="file" name="file" multiple="">

Hi guys, our company's website has this button for uploading multiple images. How can I create a script that automatically selects the images then uploads them? I already know the path of each images. I just don't want to script a click on the file upload button since I get a headache trying to make that work. My current goal is to script it with something like:

$files1 = "C:TeamBuildingTeam Games.jpg"

$files2 = "C:TeamBuildingTeam Prayer.jpg"

$oIE.getelementbyid("file").upload $files1, $files2

 

Then after the image upload the form is submitted. Obviously the code above is a fantasy :D I just need the part to script uploading the images instead of clicking the upload button. My Autoit script will modify the innerHTML of this form to add the script for auto-upload. Is this doable? 

Edited by Wolfiesaxah

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_ieaction(,"click") the 'upload' button...it'll open an upload window.  Grab the edit for the file path/name, ControlSetText, click the upload button on the window.

If you use my signature to grab the edit, the xpath would be:

$xpath = "//input[@name='file']"
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

No known script to achieve this automatically?

Share this post


Link to post
Share on other sites

I'll help you adjust a script you attempt to write, but I'm not going to dig through the forum to help you.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I have digged through the forums and your signature, learned a lot of cool stuffs :) This one however, I don't even know where to start, no articles regarding programing file upload, there are some from ASP but don't wan't it in ASP

Share this post


Link to post
Share on other sites

Hi Jdelaney, how do I get or script a click on the upload button? I do not know the ID of that button. Or do instead do a sendkey for ENTER?

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
Sign in to follow this  
Followers 0