Jump to content

Please tell me where to place this at in this script or if it's wrong


Recommended Posts

Sorry, but I'm out of ideas, I've never used ftp.

If it were me, I'd be looking through the many ftp upload example scripts you can find in example scripts section, testing and studying them.

But I'll have to bow out for now I'm afraid.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

RickB75,

Try it like this...

$host = "my server" ; Hostname of the webserver (Can be a domain name or an IP)
$user = "xxxxxxxxxx" ; FTP Username
$pass = "xxxxxxxxxxx" ; FTP Password
$folder = "/windowsticker" ; This is the folder where your files will upload to

$myFile = "C:\UCC\100.png"

ConsoleWrite($myFile & ' file size = ' & FileGetSize($myfile) & @LF) ; <------------  display local file size at console

_DebugSetup("Debug", True,2)

$open = _FTP_Open("Myftp")
_DebugOut("FTP Open Return:"&$open)
$conn = _FTP_Connect($open, $host, $user, $pass)
_DebugOut("FTP Connect Return:"&$conn)
;_FTP_Connect($open, $host, $user, $pass,0,0) ;### Debug MSGBOX
$result=_FTP_FilePut($conn, $myFile,"/windowsticker/100.png")       ; <-------------  hardcoded remote file name 
_DebugOut("FTP FilePut Return:"&$result&" - Error:"&@error)
_FTP_Close($open)

Run this using F5 from SCITE and verify that the file that you are feeding FTP is not 0 bytes long.

kylomas

edit:additional info

If the above does not work, try this. I run this several times per hour and it never fails.

FTPfile("C:\UCC\100.png","100.png")


Func FTPfile($lfn,$rfn)

    Local $server       = '******************'          ; <==============   supply your server
    Local $username     = '***********'                 ; <==============   supply your username
    Local $pass         = '***********'                 ; <==============   supply your password

    Local $Open = _FTP_Open('My FTP')
    If $open = 0 Then
        MsgBox(0,'Open Error',@error & @LF & _WinAPI_GetLastErrorMessage())
        Exit
    endif

    Local $Conn = _FTP_Connect($Open, $server, $username, $pass)
    If $conn = 0 Then
        MsgBox(0,'Connect Error',@error & @LF & _WinAPI_GetLastErrorMessage())
        exit
    endif

    Local $put  = _FTP_FilePut($conn,$lfn,"/windowsticker/" & $rfn)
    If $put = 0 Then
        MsgBox(0,'File Put Error',@error & @LF & _WinAPI_GetLastErrorMessage())
        exit
    EndIf

    Local $Ftpc = _FTP_Close($Open)
    If $ftpc = 0 Then
        MsgBox(0,'FTP CLose Error',@error & @LF & _WinAPI_GetLastErrorMessage())
        exit
    EndIf

endfunc

If this does not work, call your provider and they can tell you what the server is reporting.

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Guys, your recommendations are working but it is still returning 0 bytes on the server for the file size. I think this is an issue beyond Autoit. I am going to call tech support at godaddy and see if I can make some headway with those guys.

Kylomas

Thank you for your help. I'm getting the same results with all three versions of the scripts. I know the scripts are working because it is returning the file size and writing it to the console.

John

Thank you for your help also.

It is very, very appreciated.

If there is anything that I can do to help you guys in anyway please let me know!

Once again, thank you.

Link to comment
Share on other sites

Update.....

Guys, My FTP script is now working correctly. I called Godaddy and spoke with their Tech Support dept, and the problem was _FTP_Connect was not set to connect in passive mode!!! Once I changed that setting, it went through perfect.

Wow, this is going to be a major jump forward for me for saving time. Thanks so much to you guys for your help and to this amazing forum!!! Major kudos to you guys!!!!!

Thank you!

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

×
×
  • Create New...