Sign in to follow this  
Followers 0
scriptkid

help me! script for upload file FTP

7 posts in this topic

Hi everybody,

I wrote a script for upload file to FTP server and i copied FTP.au3 file follow http://www.autoitscript.com/forum/index.ph...ost&id=3314 link, put that in my folder inlcude

But it's can not connect FTP server. It's fail. Can you advise me? pls.

It's inform "Connection was fail".. :)

This is my script as below:

#include <FTP.au3>

$s_ServerName = 'gentleman.110mb.com'

$s_Username = 'gentleman'

$s_Password = '*****'

$SourceFile ='D:\test.htm'

;-----Open session-------

$Open = _FTPOpen("Myftp")

;------ Connect FTP server-------

$ Conn = _FTPConnect(_FTPOpen(""), $s_ServerName, $s_Username, $s_Password)

If $ Conn = 0 Then MsgBox(4096, "", "Connection was fail", 10)

;-------- Upload a file-----------

$Ftpp = _FtpPutFile($ Conn , $SourceFile, '/test.htm')

if $Ftpp = 1 then MsgBox(4096, "","Upload successed a file" )

;-------- Close connection---------

$Ftpc = _FTPClose($Open)

if $Ftpc = 1 then MsgBox(4096, "","Disconnected")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi everybody,

I wrote a script for upload file to FTP server and i copied FTP.au3 file follow http://www.autoitscript.com/forum/index.ph...ost&id=3314 link, put that in my folder inlcude

But it's can not connect FTP server. It's fail. Can you advise me? pls.

It's inform "Connection was fail".. :)

This is my script as below:

Well, not sure if it'll make any diff but...

try

$Conn = _FTPConnect($open $s_ServerName, $s_Username, $s_Password)

instead of

$Conn = _FTPConnect(_FTPOpen(""), $s_ServerName, $s_Username, $s_Password)

Also, you have a space between the $ and conn, remove that so it's like this

$Conn

and just to verify, you ARE using the right credentials & all that, and you know the FTP server works?

~cdkid

Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Make sure you read the part about the need to DllOpen() WinInet.dll and use the returned handle.

Many times asked...many times answered so you should find a hit somewhere in the forum.

:)

Edited by JdeB

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

Thanks cdkid for reply,

Yes, i tried as you say.

$Conn = _FTPConnect(_FTPOpen(""), $s_ServerName, $s_Username, $s_Password)

but it was fail.

Make sure, between the $and conn does not a space. I check again already. ( if it have a space, it don't understand variable $conn)

i usually check it by Totalcmd soft and i sure it's very good. i can upload/download files by totalcmd or Dos command

Cdkid, i need your opinion. can you help me.

Has anybody advice me? Pls.

Share this post


Link to post
Share on other sites

Read JdeB's post, dude. Pretty sure he gave you an answer.

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Make sure you read the part about the need to DllOpen() WinInet.dll and use the returned handle.

Many times asked...many times answered so you should find a hit somewhere in the forum.

;)

Ok, i try to check again in the forum as you say.

Thanks JdeB , ;)

( but if you can post link at here, I thank verymuch,:) )

Share this post


Link to post
Share on other sites

OH, now it's well.

Thanks all. :)

Now, i know why it don't worked

I lack $dllop=DllOpen('wininet.dll').

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