Jump to content
Sign in to follow this  
Zaklinadlo

FTP doesn't work !

Recommended Posts

Zaklinadlo

Hello everyone,

I searched a lot but I can't find anywhere an answer to my problem...

I'm simply trying to upload an ".htm" file to my website using AutoIt3.

But it doesn't work at all!

Here is my code:

$server = 'ftp://mywebsite.net'
    $username = 'myusername'
    $pass = 'mypassword'

    $Open = _FTPOpen('MyFTP Control')
    $Conn = _FTPConnect($Open, $server, $username, $pass)
    $Ftpp = _FtpPutFile($Conn, $mypath&"\logfiles"&$date&".htm", "/path/sub/logfiles"&$date&".htm")
    $Ftpc = _FTPClose($Open)

Did I do something wrong?

Thank you for your help.

Share this post


Link to post
Share on other sites
Zaklinadlo

Wow, that was fast!

I downloaded the FTP.au3 file and included it...

Do I need the Ex one?

Share this post


Link to post
Share on other sites
Zaklinadlo

Ok, thank you, I realised that I got an old version of AutoIt3...

Names of functions are changed, but no more results :S

$server = 'ftp://mywebsite.net'
    $username = 'myusername'
    $pass = 'mypassword'

    $Open = _FTP_Open('MyFTP Control')
    $Conn = _FTP_Connect($Open, $server, $username, $pass)
    $Ftpp = _FTP_FilePut($Conn, $mypath&"\logfiles"&$date&".htm", "/path/sub/logfiles"&$date&".htm")
    $Ftpc = _FTP_Close($Open)
Edited by Zaklinadlo

Share this post


Link to post
Share on other sites
l3ill

Try this before we start debugging to see if you can upload a file at all with your settings

Edited: this should work

#include <FTPEx.au3>

Global $l_FTPSession, $sFilePath, $s_RemotePath, $Open

$server = ''
$username = ''
$pass = ''
$Open = _FTP_Open('MyFTP')
$l_FTPSession = _FTP_Connect($Open, $server, $username, $pass)

$sFilePath = FileOpenDialog ( "FTP Upload", @DesktopDir, "All Files (*.*)")
If NOT @Error Then
    $sFileName = StringRegExpReplace($sFilePath, ".+\\(.*\..*)$", "/$1")
    _FTP_FilePut($l_FTPSession, $sFilePath, $s_RemotePath & $sFileName)
    _FTP_ProgressUpload($l_FTPSession, $sFileName, $s_RemotePath)

EndIf
Edited by billo

Share this post


Link to post
Share on other sites
Zaklinadlo

I tried and got that:

C:\Users\Andre\Documents\AutoIt\test.au3(13,82) : ERROR: syntax error (illegal character)

$sFileName = StringRegExpReplace($sFilePath, ".+\\(.*\..*){:content:}quot;, "/$1"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Andre\Documents\AutoIt\test.au3 - 1 error(s), 0 warning(s)

EDIT: Okay, got it to work... Trying...

EDIT2: I selected a file but it's not on my FTP... :idea:

But when i'm using my FTP software it works, i don't understand why it doesn't with AutoIt...

Edited by Zaklinadlo

Share this post


Link to post
Share on other sites
Zaklinadlo

Isnt it the same thing?

>Still not working.

Share this post


Link to post
Share on other sites
Zaklinadlo

Okay, I see the difference...

But still not working :@

Share this post


Link to post
Share on other sites
Zaklinadlo

No results... :idea:

Share this post


Link to post
Share on other sites
Zaklinadlo

Lol yes I am.

Share this post


Link to post
Share on other sites
Zaklinadlo

I verified and _FTP_Connect() returns an error.

Edited by Zaklinadlo

Share this post


Link to post
Share on other sites
Zaklinadlo

A second too late :idea:

With "http://www.mywebsite.com" I got an error.

With "ftp.mywebsite.com" it's okay but the file doesn't upload.

No error on FileOpenDialog too.

ERROR on _FTP_FilePut and _FTP_ProgressUpload.

Edited by Zaklinadlo

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  

×