Jump to content
Sign in to follow this  

winhttp upload problem

Recommended Posts


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
;php upload form: www.ajoko.com/log/index.php

I attached winhttp



Share this post

Link to post
Share on other sites

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

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))) {
<title>File Upload</title>
<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" />

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.