Sign in to follow this  
Followers 0
chariot

How can I auto set file path for input file in IE

8 posts in this topic

Hello I'm newbie in autoit.

I have a question about how can I set file path to input file Zbrowser file to upload to website) in IE.

for input text I can use

_IEPropertySet($name,"innertext","Test")

but for input file I'can, and I try to use

_IEPropertySet($oFile,"value","D:\pic.jpg")

but It's don't work.

How can I do? :P

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thank you but it doesn't work too.

Edited by chariot

Share this post


Link to post
Share on other sites

You can't set (in the most browsers and I "hope" in IE, too) an "input type='file'", because of security reasons.

Share this post


Link to post
Share on other sites

You can't set (in the most browsers and I "hope" in IE, too) an "input type='file'", because of security reasons.

Why would that be a dangerous thing to do?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Why would that be a dangerous thing to do?

If that would be possible, every script on every page can fill out an input field of this type and can try if it can download any file from your computer.

Edited by Stilgar

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If that would be possible, every script on every page can fill out an input field of this type and can try if it can download any file from your computer.

I see. That is important for Javascript, but not for IE COM in my opinion since a process is already running that has access to your hard drive.

You are right. :P

In the help file see _IEFormElementSetValue

it shows this example:

; *******************************************************
; Example 4 - Set the value of an INPUT TYPE=FILE element
;               (security restrictions prevent using _IEFormElementSetValue)
; *******************************************************
;
#include <IE.au3>

$oIE = _IE_Example("form")
$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oInputFile = _IEFormElementGetObjByName($oForm, "fileExample")

; Assign input focus to the field and then send the text string
_IEAction($oInputFile, "focus")
Send("C:\myfile.txt")
Edited by Manadar

Share this post


Link to post
Share on other sites

I see. That is important for Javascript, but not for IE COM in my opinion since a process is already running that has access to your hard drive.

If you look in the IE.au3 every "function" on the com-objects are Javascript-functions, so I think this is blocked by the IE.

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