Jump to content

Search the Community

Showing results for tags 'upload files'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello everyone! I am trying to make a script that uploads files for me in wordpress(All I need to do is to manually choose which files to upload) Here is my script so far: #include <FileConstants.au3> #include <MsgBoxConstants.au3> Upload() Func Upload() $sPD = "log=username&pwd=mypassword&wp-submit=Log+ind&redirect_to=http%3A%2F%2Fmyurl.com%2Fwp-admin%2F&testcookie=1" oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myurl.com/wp-login.php " & $sUSR, False) ; Post url $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.5") $oHTTP.SetRequestHeader("User-Agent", "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.52 YaBrowser/15.12.2490.3614 (beta) Yowser/2.5 Safari/537.36") $oHTTP.SetRequestHeader("Referer", "http://myurl.com/wp-login.php?redirect_to=http%3A%2F%2Fmyurl.com%2Fwp-admin%2F&reauth=1") $oHTTP.SetRequestHeader("Cookie", "wordpress_test_cookie=WP+Cookie+check") $oHTTP.SetRequestHeader("Connection", "keep-alive") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ; Header data > $oHTTP.Send($sPD) $oHTTP.Open("GET", "http://myurl.com/wp-admin/media-new.php", False) ; Post url $oHTTP.SetRequestHeader("Host", "myurl.com") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.5") $oHTTP.SetRequestHeader("Referer", "http://myurl.com/wp-admin/") $oHTTP.Send() Endfunc The upload button = "Choose Files" Example code from: https://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm #include <FileConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Select a single file of any type." ; Display an open dialog to select a file. Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "All (*.*)", $FD_FILEMUSTEXIST) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file was selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the selected file. MsgBox($MB_SYSTEMMODAL, "", "You chose the following file:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>Example The HTML: <p class="drag-drop-buttons"><input style="position: relative; z-index: 1;" id="plupload-browse-button" value="Choose Files" class="button" type="button"></p> Some header info in the HTTP request: POST http://myurl.com/wp-admin/async-upload.php HTTP/1.1 Host: myurl.com User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://myurl.com/wp-admin/media-new.php Content-Length: 4555551 Content-Type: multipart/form-data; boundary=---------------------------12345678910 Cookie: LONG COOKIE HERE! DNT: 1 Connection: keep-alive -----------------------------102062144610664 Content-Disposition: form-data; name="name" hdfhfg.jpg -----------------------------102062144610664 Content-Disposition: form-data; name="post_id" 0 -----------------------------102062144610664 Content-Disposition: form-data; name="_wpnonce" 123456 -----------------------------102062144610664 Content-Disposition: form-data; name="type" -----------------------------102062144610664 Content-Disposition: form-data; name="tab" -----------------------------102062144610664 Content-Disposition: form-data; name="short" 1 -----------------------------102062144610664 Content-Disposition: form-data; name="async-upload"; filename="hdfhfg.jpg" Content-Type: image/jpeg This wouldn't be much of a problem if I just had some simple post data, but this makes my head spin.... Thanks in advance Masters! (I could probably easily do this with IE, but I'd rather not use IE, I am not a big fan of it)
×
×
  • Create New...