Jump to content

FTP doesn't work !


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

Make sure your looking in the root folder of your site...unless you changes the remote path var.

did you ever get around to updating your autoit version.

Edited by billo
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...