Jump to content

Recommended Posts

Hi have a page with this content:

<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

I want auto it to fill in the filepath with the var $file and then submit the form.

How to do?

Regards Darkbanner

Link to post
Share on other sites

#include <IE.au3>
Local $oIE = _IECreate("http://razorhosting.de/imgspy/")
Local $oForm = _IEFormGetObjByName($oIE, "form")
Local $oText = _IEFormElementGetObjByName($oForm, "file")
Local $oSub = _IEFormGetObjByName($oIE, "submit")
_IEFormElementSetValue($oText, "Hey! This works!")
Sleep(100)
_IEFormSubmit($oForm)

This inserts the "hey! this works!" text but the submit don't work

Link to post
Share on other sites

This is very easy, I recommend that you sit down and read the winhttp.au3 instruction manual, more specifically, read about "_WinHttpSimpleFormFill".

#include "WinHttp.au3"
Global $hOpen, $hConnect, $sRead

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, "domain.com")
$sRead = _WinHttpSimpleFormFill($hConnect, "test.php", "index:0", "name:file", $FileLocation)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...