Sign in to follow this  
Followers 0
RexRomae

File Upload

9 posts in this topic

I have to transfer with FTP.au3 a file (win32.rar)

This is my code but it can't work (not upload)

#include <file.au3>

#include <FTP.au3>

DllOpen('wininet.dll')

$server = 'mysite.com'

$username = 'username'

$pass = 'password'

$Open = _FTPOpen('MyFTP Control')

$Conn = _FTPConnect($Open, $server, $username, $pass)

$Ftpp = _FtpPutFile($Conn, 'c:\win32.rar', '/win32.rar')

$Ftpc = _FTPClose($Open)

why??

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Not sure, but you may have to set $i_Flags to either 1 or 2 to get a binary transfer.

EDIT:

Try the following

$Ftpp = _FtpPutFile($Conn, 'c:\win32.rar', '/win32.rar')
MsgBox(0, "TEST", $ftpp)
I think that should return the error code as follows

Error >> Constant >> Description

NO_ERROR >> 0 >> Represents no error.

UNKNOWN_HOST >> 1 >> HOST is not found.

USER_CANNOT_LOGIN >> 2 >> The given password and login name are not correct.

REMOTE_FILE_NOT_FOUND >> 3 >> File requested by the Get method does not exist at the remote side.

LOCAL_FILE_NOT_FOUND >> 4 >> Local file is not present.

INVALID_PATH >> 5 >> Given path to Put the file is not valid.

ACCESS_DENIED >> 6 >> Access to Put the file at FTP Server is denied.

INVALID_MODE >> 7 >> The mode is not valid.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

it print 1

now?? mmm

Share this post


Link to post
Share on other sites

it print 1

now?? mmm

According to that table of errors you have something wrong in the connection string, and with your code it will be $Server which is incorrect.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

ops! $server = 'ftp.mysite.com'

it's work now!!

thanks!

Share this post


Link to post
Share on other sites

ops! $server = 'ftp.mysite.com'

it's work now!!

thanks!

Np

Wrong $server will cause a problem every time.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Tried this simple script and for some reason the server is closing the connection right after it is opened.

I have access to the server logs and can verify the username and pass is correct but not why the connection is closed right away.

Any ideas why this would happen?

The server is Serv-U FTP if that helps at all.

Thanks

Share this post


Link to post
Share on other sites

can you manually login without connection closing ?


[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

can you manually login without connection closing ?

Sure can. Used a couple a different clients, IE and even FireFTP (Firefox addon) and all worked perfect.

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  
Followers 0