Devv Active Member Licensed User Longtime User Sep 24, 2014 #1 when i use the following code Code: Copy File.WriteString(File.DirInternal,"file.txt","hello") FTP.Initialize("FTP","ftp.mysite.com",21,"user","pass") FTP.UploadFile(File.DirInternal,"file.txt",False,"/htdocs/file.txt") FTP.Close Msgbox("done","") every thing works file and i get the file code 2: Code: Copy File.WriteString(File.DirInternal,"file.txt","hello") FTP.Initialize("FTP","ftp.mysite.com",21,"user","pass") FTP.UploadFile(File.DirInternal,"file.txt",False,"/htdocs/file.txt") FTP.Close File.Delete(File.DirInternal,"file.txt") Msgbox("done","") when i use code 2 the file will never be uploaded and it will be deleted from the phone any ideas why it is deleting the file without uploading it ?
when i use the following code Code: Copy File.WriteString(File.DirInternal,"file.txt","hello") FTP.Initialize("FTP","ftp.mysite.com",21,"user","pass") FTP.UploadFile(File.DirInternal,"file.txt",False,"/htdocs/file.txt") FTP.Close Msgbox("done","") every thing works file and i get the file code 2: Code: Copy File.WriteString(File.DirInternal,"file.txt","hello") FTP.Initialize("FTP","ftp.mysite.com",21,"user","pass") FTP.UploadFile(File.DirInternal,"file.txt",False,"/htdocs/file.txt") FTP.Close File.Delete(File.DirInternal,"file.txt") Msgbox("done","") when i use code 2 the file will never be uploaded and it will be deleted from the phone any ideas why it is deleting the file without uploading it ?
DonManfred Expert Licensed User Longtime User Sep 24, 2014 #2 UploadFile is ansynchronous sub or not? You should wait for the UploadCompleted event before you delete the file Code: Copy Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean) Log(ServerPath & ", Success=" & Success) If Success = False Then Log(LastException.Message) else ' Delete your file here... end if End Sub Last edited: Sep 24, 2014 Upvote 0
UploadFile is ansynchronous sub or not? You should wait for the UploadCompleted event before you delete the file Code: Copy Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean) Log(ServerPath & ", Success=" & Success) If Success = False Then Log(LastException.Message) else ' Delete your file here... end if End Sub