Android Question ContentChooser and FTP

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,

I need help for send file via fro to my server.
B4X:
Sub imgChooser_Result(Success As Boolean, Dir As String, FileName As String)
'Try
TempPhotoName = RandomString(16,True,True,True,"") & ".jpg"
File.Copy(Dir ,FileName,File.DirRootExternal ,TempPhotoName  )

 FTP.UploadFile(File.DirRootExternal, TempPhotoName , True, TempPhotoName)

This code send file to server but not all file size (172 kb instead 500kb). I think its about copying image take a while and ftp is not waiting for this.

How can i fix it ? is there way send file via ftp without copy to File.DirRootExternal or handle when file copy completed.

Any help ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. File.Copy is a synchronous method. The file will be completely copied and only then the next statement will be called.

2. Don't use File.DirRootExternal. Use File.DirDefaultExternal instead.

3. Check the file size before you call FTP.UploadFile. Is it correct?

4. Are you handling the UploadedCompleted event? Is Success true?
 
Upvote 0
Top