uploading file without ftp ?

12/21/2014 02:10 fear-x#16
Quote:
Originally Posted by »FlutterShy™ View Post
in php you dont need to use ftp on your webspace^^
please show example of autoit calling php file for upload?
12/21/2014 02:12 alpines#17
_filname != _filename.

The reason the snippet you copied didn't work because there spelling errors. Correct the parameters and try again.

With AutoIt, read the file. Convert it to binary data and attach it the _filename parameter.
The php script needs to convert it back to original data (you either can use base64 or any similar data conversion method (the reason you need to convert is because you can't send some characters decoded)) and save it.

Use something like this:
PHP Code:
<?php
    $file 
fopen($_POST['_filename'], "w+");
    
fwrite($file,base64_decode($_POST['sorce']));
    
fclose($file);
?>
Code:
obj = ObjCreate("Microsoft.XMLHTTP")
$obj.open("POST","www.yoursite.to/index.php",False)
$obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
$obj.send("_filename=test.au3&sorce=" & _Base64Encode(FileRead("filename")))


Func _Base64Encode($sData)
    Local $oXml = ObjCreate("Msxml2.DOMDocument")
    If Not IsObj($oXml) Then
        SetError(1, 1, 0)
    EndIf

    Local $oElement = $oXml.createElement("b64")
    If Not IsObj($oElement) Then
        SetError(2, 2, 0)
    EndIf

    $oElement.dataType = "bin.base64"
    $oElement.nodeTypedValue = Binary($sData)
    Local $sReturn = $oElement.Text

    If StringLen($sReturn) = 0 Then
        SetError(3, 3, 0)
    EndIf

    Return $sReturn
EndFunc
12/21/2014 11:34 fear-x#18
i tried correcting the first script provided in page one , and i tried your script above now but they return no errors and exit in 0.5-0.9 sec , nothing is uploaded , i have a test.jpg in my folder but it doesnt get uploaded.

is there no way to simply call php in autoit like with html form? just inside autoit.
12/21/2014 16:03 YatoDev#19
Quote:
Originally Posted by fear-x View Post
i tried correcting the first script provided in page one , and i tried your script above now but they return no errors and exit in 0.5-0.9 sec , nothing is uploaded , i have a test.jpg in my folder but it doesnt get uploaded.

is there no way to simply call php in autoit like with html form? just inside autoit.
its as simple like connecting on every other webpage.

but you want from us to do all for you. maybe better go to coders trading
12/21/2014 17:04 fear-x#20
Quote:
Originally Posted by »FlutterShy™ View Post
its as simple like connecting on every other webpage.

but you want from us to do all for you. maybe better go to coders trading
well i have never done such a thing , program to web . maybe point me in the right direction?
12/21/2014 17:42 YatoDev#21
Quote:
Originally Posted by fear-x View Post
well i have never done such a thing , program to web . maybe point me in the right direction?
there are many examples in this thread and you will find enough with google. just a copy & paste of source and then write it doesnt work isnt a solution