Jump to content

ftp question


Recommended Posts

hi all

i have thisĀ 

#include <FTPEx.au3>

Local $sServer = 'ftp.mysite.com'
Local $sUsername = 'myusername'
Local $sPass = 'mypass'
Local $hOpen = _FTP_Open('MyFTP Control')
Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)
while 1
$file = InputBox("", "")
$open = FileOpen("file",2)
FileWrite("file",$file)
FileClose($open)
_FTP_FilePut($hConn,"file","/htdocs/file.html")
WEnd
Local $Ftpc = _FTP_Close($hConn)
Local $Ftpo = _FTP_Close($hOpen)

this cod must login to my site and upload a file called "file" with content of what the user enters in the inputbox

the problem is if i keep typing content in the input box after each others it will work fine

but when i be late for about 30 seconds or more it will not upload anything

1-my question is: does ftp have a timeout or something like that ?

2-is what im doing right i must not include the ftp open and close in the while loop ?

3-can i edit a file without re-uploading it ?

Edited by Alexxander

Link to comment
Share on other sites

Why dont you just connect to ftp after you have written your file?

Edit: and why do you loop this script? You never exit the loop?

bro my problem is not exiting the loop and i dont mind if it took more time to write the file my problem is that the connection disconnects when in active

Link to comment
Share on other sites

You are not active on the ftp connection when you are waiting for the user input, why connect to the ftp before the file is ready to upload?

And whats with the attitude? When you never exit your loop you never call the _FTPClose functions in your script..

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...