Sign in to follow this  
Followers 0
ALW

FTP Put Issue

8 posts in this topic

Good Day - I am very new to AutoIt - have gotten through a few scripts already and have decided to progress to the next level... FTP. Below is a script I wrote - gets to line 25 - the MsgBox with the "A","Upload..." and the error message is the box is -1 and the extended is 12018. My questions are: where/how does one easily decipher these message numbers and does anyone have ideas why I am getting these error messages? Unfortunately I cannot post the server/un/password due to security reasons - but have tried these server/un/pw settings in FileZilla and they work.

Any ideas would be GREATLY appreciated....

#Include <FTPEx.au3>

dim $CVSFileChannel

dim $CVSOpenStatus

dim $CVSPutStatus

dim $CVSCloseStatus

dim $FTPServer

dim $FTPUsername

dim $FTPPassword

$CVSFTPServer = "xxxxx"

$CVSFTPUsername = "xxxxx"

$CVSFTPPassword = "xxxxx"

$CVSFileChannel = _FTP_Open("MyChannel")

if ($CVSFileChannel <> 0) Then

$CVSOpenStatus = _FTP_Connect($CVSFileChannel,$CVSCodeStreetFTPServer,$CVSFTPUsername,$CVSFTPPassword,1,21)

if ($CVSOpenStatus <> 0) Then

$CVSPutStatus = _FTP_FilePut($CVSFileChannel, 'd:\garbage\ALWTest.csv','ALWTEST.TXT',$FTP_TRANSFER_TYPE_ASCII )

if ($CVSPutStatus = 1) Then

MsgBox(4096,"OONE!","Done")

Else

Msgbox(4096,"A","Upload: " & @error & " " & @extended & @CRLF)

Endif

Else

Msgbox(4096,"Error-B",@Error)

EndIf

Else

Msgbox(4096,"Error-c",@Error)

EndIf

$CVSCloseStatus = _FTP_Close($l_InternetSession)

Share this post


Link to post
Share on other sites



Hi ALW,

there is an error in your syntax regarding the id .. else .. endif.

Apart from that I don't see any error.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

My questions are: where/how does one easily decipher these message numbers

In the help file there is a link to MSDN on the _FTP_FilePut page. From there follow the link to "FtpPutFile Function (Windows)". Then the "GetLastError" link. Then "System Error Codes". Then the link to the range your error message falls within. Then choose the "Internet Error Codes" link. Do a find for your error.

If this is right your error is: The request to connect and log on to an FTP server could not be completed because the supplied password is incorrect.

$CVSCloseStatus = _FTP_Close($l_InternetSession)

Is this your production code? Why not _FTP_Close($CVSFileChannel)

Also, you are declaring $CVSFTPServer and your connect statement is using $CVSCodeStreetFTPServer. If this is truely how your testing it then I would guess your problem lies here.

Edited by Casey

Share this post


Link to post
Share on other sites

I changed the code to remove all the IF's and got to the basics so I think ... Sill get a

return status of 0 (error), a @error of -1 and extended of 12018.... is there a transalation of these messages? or other ideas?

Thank you very much

Tx.

Include <FTPEx.au3>

dim $CVSFileChannel

dim $CVSOpenStatus

dim $CVSPutStatus

dim $CVSCloseStatus

dim $CVSFTPServer

dim $CVSFTPUsername

dim $CVSFTPPassword

$CVSFTPServer = 'xxxxx'

$CVSFTPUsername = 'xxxxx'

$CVSFTPPassword = 'xxxxx'

$CVSFileChannel = _FTP_Open('MYChannel')

$CVSOpenStatus = _FTP_Connect($CVSFileChannel,$CVSFTPServer,$CVSFTPUsername,$CVSFTPPassword,1,21)

$CVSPutStatus = _FTP_FilePut($CVSFileChannel, 'd:\garbage\ALWTest.csv','ALWTEST.TXT',$FTP_TRANSFER_TYPE_ASCII )

msgbox(4096,"Status",$CVSPutStatus&' ** '&@error& ' ** ' & @extended )

$CVSCloseStatus = _FTP_Close($CVSFileChannel)

Share this post


Link to post
Share on other sites

In the help file there is a link to MSDN on the _FTP_FilePut page. From there follow the link to "FtpPutFile Function (Windows)". Then the "GetLastError" link. Then "System Error Codes". Then the link to the range your error message falls within. Then choose the "Internet Error Codes" link. Do a find for your error.

If this is right your error is: The request to connect and log on to an FTP server could not be completed because the supplied password is incorrect.

tx - will have to check again and appreciate the deciphering of the error.... probably an error right bfore my eyes.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

$CVSPutStatus = _FTP_FilePut($CVSFileChannel

I think your looking for a begining like $CVSPutStatus = _FTP_FilePut($CVSOpenStatus

Edited by Casey

Share this post


Link to post
Share on other sites

I think your looking for a begining like $CVSPutStatus = _FTP_FilePut($CVSOpenStatus

That was it THANK YOU!!!!!!!!!!

Share this post


Link to post
Share on other sites

That was it THANK YOU!!!!!!!!!!

Yep, glad to help.

Casey

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