Sign in to follow this  
Followers 0
davidkim

not send image (UDF _WinHttpSimpleFormFill)

1 post in this topic

#1 ·  Posted (edited)

server php source....is

save to upload.php

------------------------------------------------------------------------------------------

<html>
<head>
<title>File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000">
<input name="upfile" type="file"><br>
<input type="submit" name="submit" value="Upload">
</form>
</body>

<?php
if (isset($_POST['submit']) && !empty($_FILES["upfile"]) && move_uploaded_file($_FILES['upfile']['tmp_name'], "up/".basename($_FILES['upfile']['name']))) {
   echo "move ok "."up/".basename($_FILES['upfile']['name']);
} else {
  echo "not move ".$_FILES['upfile']['error']." ->".$_FILES['upfile']['tmp_name']." ->".$_FILES['upfile']['type'];
}
?>

---------------------------------------------------------------------------------------------------

upload.au3 source.....

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Language=1042
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "WinHttp.au3"
Global Const $Adresas = "test_website.com"
$subdomain = "/upload.php"
$file = @scriptdir & "tttt.txt"
Global $test = _WinHttpCreateUrl($Adresas)
Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1")
Global $hConnect = _WinHttpConnect($hOpen, $Adresas)
$Token = _WinHttpSimpleRequest($hConnect, "POST")

Global $sHTM = _WinHttpSimpleFormFill($hConnect, $subdomain, "index:0", "name:upfile", $file ,"X-Atlassian-Token: nocheck")

_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

ConsoleWrite($sHTM )

it's tttt.txt is upload......Successfully uploaded.

but

$file = @scriptdir & "tttt.jpg"

   or

$file = @scriptdir & "tttt.zip"

 

don't upload.......  

echo $_FILES['upfile']['error'] ==> value is 3...

 

 

 

how to can image or zip file upload????

Edited by davidkim

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

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