Jump to content



Photo

winhttp upload problem


  • Please log in to reply
2 replies to this topic

#1 powermaster

powermaster

    Seeker

  • Active Members
  • 17 posts

Posted 11 June 2012 - 04:03 PM

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 winhttp

Attached Files









#2 powermaster

powermaster

    Seeker

  • Active Members
  • 17 posts

Posted 11 June 2012 - 06:09 PM

if needed this is the php file i use with winhttp:

Plain Text         
<?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>


#3 powermaster

powermaster

    Seeker

  • Active Members
  • 17 posts

Posted 13 June 2012 - 01:32 PM

no replies?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users