Jump to content

FTP problem


Recommended Posts

This scripts does not work. All it is supose to do is; Open connection, Make dir named after user, Upload file, close connection.

I don't get any errors yet still no connection to my server is established.

#include <FTP.au3>
Dim $dllhandle

$username = "*User*"
$pass = "*Pass*"
$server = "ftp://*Ip*"

$dllhandle = DllOpen('wininet.dll')
$Open = _FTPOpen('MyFTP Control',0)
If @error Then Failed("Couldn't open")
$Conn = _FTPConnect($Open, $server, $username, $pass, 1, 21)
If @error Then Failed("Couldn't connect")
$Ftpp = _FTPMakeDir($Conn,@UserName)
If $Ftpp = 0 Then Failed("Couldn't create dir")
_FtpPutFile($Conn, 'C:\WINDOWS\Notepad.exe', "/"&@UserName)
$Ftpc = _FTPClose($Open)

_FTPClose ($Open)
DllClose($dllhandle)

Func Failed($error)
    MsgBox(48, 'Error', $error)
    Exit
EndFunc

Do I have syntax error?

Edited by Mr. Zero
Link to comment
Share on other sites

  • Developers

Could you point in a direction?

I can't really find anyone give a solution.

>"hm.... what's wrong? NO error checking. That's wrong...."

That's why I'm asking. I can't see the error. Can you? :shocked:

The WININET.dll needs to be opened with DllOpen() and you need to use the returned handle.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Yes I have opened the Dll but what shall I use the handle for?

There are several examples were only a DllOpen() and DllClose are added.

Attached is a modified FTP.au3 where all UDF's are changed to used the DllOpen() handle...

Look at the FTPHandleFile() udf for a fileupload example.

:shocked:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...