powermaster Posted June 11, 2012 Posted June 11, 2012 Hi. I got this script using winhttp to upload files to a webserver using a php file. The problem is, it will only upload small files for some reason. If the file is example 100 kb, it works fine, if the file is 3 mb, then the scripts stops, and it never gets uploaded (and it works just fine uploading via the php form directly, so it's the script that got a problem) even I tell it to start uploading "pictures1" witch is 3 mb, first, then it skips it, and only uploads "pictures2" witch is 100 kb. #include "WinHttp.au3" Global Const $sAddress = "ajoko.com" $subdomain = "log/index.php" $1 = ("pictures1.zip") ;upload 1 $2 = ("pictures2.zip") ;upload 2 Global $hOpen = _WinHttpOpen() Global $hConnect = _WinHttpConnect($hOpen, $sAddress) Global $sHTM = _WinHttpSimpleFormFill($hConnect, $subdomain, Default, "name:ufile", $1) ;upload 1 Global $sHTM = _WinHttpSimpleFormFill($hConnect, $subdomain, Default, "name:ufile", $2) ;upload 2 _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ;php upload form: www.ajoko.com/log/index.php I attached winhttpWinHttp.au3WinHttpConstants.au3
powermaster Posted June 11, 2012 Author Posted June 11, 2012 if needed this is the php file i use with winhttp: <?php if(isset($_POST['submit'])) { if((!empty($_FILES["ufile"])) && ($_FILES['ufile']['error'] == 0)) { $oldfilename = basename($_FILES['ufile']['name']); $path = 'uploads/'; $curtime = $_SERVER['REMOTE_ADDR']; $test = time(); if (is_dir($path.$curtime)) { echo "The directory {$dirname} exists"; } else { mkdir($path . $curtime,0777,TRUE); } $filename = $test. "_" . $oldfilename; if ((move_uploaded_file($_FILES['ufile']['tmp_name'],$path . $curtime . '/' . $filename))) { } } } ?> <html> <head> <title>File Upload</title> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> Select file: <input name="ufile" type="file" /><br /> <input type="submit" name="submit" value="Upload" /> </form> </body> </html>
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now