Jump to content
Sign in to follow this  
PantZ4

FTP problem

Recommended Posts

PantZ4

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

Share this post


Link to post
Share on other sites
PantZ4

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:

Share this post


Link to post
Share on other sites
Jos

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.

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
PantZ4

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

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

Share this post


Link to post
Share on other sites
Jos

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:


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×