Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 00:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



uploading file without ftp ?

Discussion on uploading file without ftp ? within the AutoIt forum part of the Coders Den category.

Reply
 
Old 12/21/2014, 02:10   #16
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,234
Received Thanks: 1,095
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?
fear-x is offline  
Old 12/21/2014, 02:12   #17
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
_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
alpines is offline  
Old 12/21/2014, 11:34   #18
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,234
Received Thanks: 1,095
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.
fear-x is offline  
Old 12/21/2014, 16:03   #19
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
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
YatoDev is offline  
Old 12/21/2014, 17:04   #20
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,234
Received Thanks: 1,095
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?
fear-x is offline  
Old 12/21/2014, 17:42   #21
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
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
YatoDev is offline  
Reply




All times are GMT +1. The time now is 00:37.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.