scriptguru, I'm trying to use your function but something doesnt work. have a look at my case: i have apache + php installed correctly (other php apps currently running on the server) a php page to receive the uploded file : uploader.php a html page with form to test uploading through browser: form.html the upload works. I find the uploaded file inside the "/upload" folder. now, i want to code an AU3 script UPLOADER.au3, to send the file without using browser. uploader.php <%
$target_path = "upload/";
$target_path = $target_path . basename( $_FILES['filename']['name']);
if( move_uploaded_file($_FILES['filename']['tmp_name'], $target_path) ) {
echo "The file ". basename( $_FILES['filename']['name']).
" has been uploaded";
echo "<p>Parameter ..... P= " . htmlspecialchars($_POST['p']);
}
else{
echo "There was an error uploading the file, please try again!";
}
%> form.html <form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="200000000" />
P = <input type="text" name="p" value="1" /><p>
Choose a file to upload: <input name="filename" type="file" /><br />
<input type="submit" value="Upload File" />
</form> the UPLOADER.au3 so far: #include <Base64.au3>
#include <_HTTP.au3>
#include <_HTTPPost_files.au3>
#NoTrayIcon
$BYTES=0
$host='localhost'
$port=80
$page='/php_file_upload/uploader.php'
$SOCKET = _HTTPConnect($host, $port) ; #1
dim $data[1]
dim $filenames[1]
$data[0] = _HTTPEncodeString( "p=1000000" )
$filenames[0] = "C:\Tools\Autoit\alex\UPLOADER\hello2.exe" ; this is a very small file 73 bytes
; being .exe has nothing to do. i tried with .zip, txt, and other types with no success
$BYTES= _HTTPPost_files($host, $page, $socket, $data, $filenames ) ; #2
$closeit = _HTTPClose($socket) ; #3 the script executes, ..... #1, #2, #3 return success codes , no @error, no @extended the $BYTES variable ends with some value > 0 but the file is not uploaded into "/uploads"