Android Question Net FTP

taylorw

Active Member
Licensed User
Hi all,i trying to use net ftp to upload image to my server but some problem like below picture:
upload_2017-7-21_13-18-8.png

The file size is 0KB and after few minutes the file was missing.Any idea for this?
 

taylorw

Active Member
Licensed User
Hi DonManfred,thank for your reply.
Just now I try to change my coding to
B4X:
FTP.Initialize("FTP", "Myftp", 21, "USer", "Password")
    FTP.PassiveMode = True

B4X:
FTP.UploadFile(Dir, FileName, True, "/Vegetrade/test.jpg")

B4X:
Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
    Dim s As String
    s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
    If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
    Log(s)
End Sub

Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
    Log(ServerPath & ", Success=" & Success)
    If Success = False Then Log(LastException.Message)
   
End Sub

Now already can upload but the image is corrupt.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
FTP.UploadFile(Dir, FileName, True, "/Vegetrade/test.jpg")
so it is a TEXT file?

ploadFile (DeviceFolder As String, DeviceFile As String, AsciiFile As Boolean, ServerFilePath As String)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
What is the LOG output? You already have the log inside your code. Why you DID NOT post it directly to give us all infos?
 
Upvote 0

taylorw

Active Member
Licensed User
DonManfred, it is a jpg file.
Sorry,what directly infos you need?
And i don't know after
B4X:
FTP_UploadProgress
it will not go to
B4X:
FTP_UploadCompleted
 
Upvote 0

taylorw

Active Member
Licensed User
Sorry Donmanfred for my bad english.:(
This is my log.
B4X:
Logger connected to:  HUAWEI PLK-L01
--------- beginning of main
** Activity (frmitem_maintenance) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (frmview_item) Create, isFirst = true **
Class not found: anywheresoftware.b4a.samples.customlistview.customlistview, trying: b4a.example.customlistview
-Start-
State: 16842910
State: 16843597
-End-
Yeah, it is!
** Activity (frmview_item) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
Response from server: [{"Run_No":"0","Call_No":"Broccoli","Item_Code":"10003","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Broccoli","Item_Name_CN":"\u82b1\u6930\u83dc","Item_Name_BM":"Broccoli","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"2"},{"Run_No":"2","Call_No":"Banana","Item_Code":"10004","Item_Description":"","Item_Category":"Fruit","Item_Name_EN":"Banana","Item_Name_CN":"\u9999\u8549","Item_Name_BM":"Banana","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"1"},{"Run_No":"3","Call_No":"Chilli","Item_Code":"10005","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Chilli","Item_Name_CN":"\u8fa3\u6912","Item_Name_BM":"Chilli","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"4"},{"Run_No":"4","Call_No":"Red been","Item_Code":"10006","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Red been","Item_Name_CN":"\u7ea2\u8c46","Item_Name_BM":"Red been","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"8"},{"Run_No":"5","Call_No":"Carrot","Item_Code":"10007","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Carrot","Item_Name_CN":"\u841d\u535c","Item_Name_BM":"Carrot","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"3"},{"Run_No":"6","Call_No":"potato","Item_Code":"10008","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"potato","Item_Name_CN":"\u756a\u85af","Item_Name_BM":"potato","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"7"},{"Run_No":"7","Call_No":"Onion","Item_Code":"10009","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Onion","Item_Name_CN":"\u6d0b\u8471","Item_Name_BM":"Onion","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"6"},{"Run_No":"8","Call_No":"Tomato","Item_Code":"10010","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Tomato","Item_Name_CN":"\u756a\u8304","Item_Name_BM":"Tomato","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"9"},{"Run_No":"9","Call_No":"Kale","Item_Code":"10011","Item_Description":"","Item_Category":"Vegetable","Item_Name_EN":"Kale","Item_Name_CN":"\u82a5\u5170","Item_Name_BM":"Kale","Item_Status":"Active","Remark":"","Image_Path":"No_Yet","Round_By_Item_Name":"5"}]
** Activity (frmview_item) Pause, UserClosed = true **
** Activity (frmitem_maintenance) Create, isFirst = true **
** Activity (frmitem_maintenance) Resume **
Response from server: [{"Last_Item_Code":"10011"}]
Response from server: [{"User_ID":"Bolevard","User_Name":"Bolevard Hypper Market"},{"User_ID":"Emart","User_Name":"Emart Hypper Market"},{"User_ID":"Super Market","User_Name":"Super Market"}]
Response from server: [{"UOM":"KG"},{"UOM":"Box"}]
Response from server: [{"Category_Code":"Fruit","Category_Description":"Fruit","Add_User":null,"Add_Date":null,"Add_Time":null,"Update_User":null,"Update_Date":null,"Update_Time":null},{"Category_Code":"Vegetable","Category_Description":"Vagetable","Add_User":null,"Add_Date":null,"Add_Time":null,"Update_User":null,"Update_Date":null,"Update_Time":null}]
** Activity (frmitem_maintenance) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
** Activity (frmitem_maintenance) Resume **
Uploaded 1KB
Uploaded 2KB
Uploaded 3KB
Uploaded 4KB
Uploaded 5KB
Uploaded 6KB
Uploaded 7KB
Uploaded 8KB
Uploaded 9KB
Uploaded 10KB
Uploaded 11KB
Uploaded 12KB
Uploaded 13KB
Uploaded 14KB
Uploaded 15KB
Uploaded 16KB
Uploaded 17KB
Uploaded 18KB
Uploaded 19KB
Uploaded 20KB
Uploaded 22KB
Uploaded 23KB
Uploaded 24KB
Uploaded 25KB
Uploaded 26KB
Uploaded 27KB
Uploaded 28KB
Uploaded 29KB
Uploaded 30KB
Uploaded 31KB
Uploaded 32KB
Uploaded 33KB
Uploaded 34KB
Uploaded 35KB
Uploaded 36KB
Uploaded 37KB
Uploaded 38KB
Uploaded 39KB
Uploaded 40KB
Uploaded 41KB
Uploaded 42KB
Uploaded 43KB
Uploaded 44KB
Uploaded 45KB
Uploaded 46KB
Uploaded 47KB
Uploaded 48KB
Uploaded 49KB
Uploaded 50KB
Uploaded 51KB
Uploaded 52KB
Uploaded 53KB
Uploaded 54KB
Uploaded 55KB
Uploaded 56KB
Uploaded 57KB
Uploaded 58KB
Uploaded 59KB
Uploaded 60KB
Uploaded 61KB
Uploaded 62KB
Uploaded 63KB
Uploaded 65KB
Uploaded 66KB
Uploaded 67KB
Uploaded 68KB
Uploaded 69KB
Uploaded 70KB
Uploaded 71KB
Uploaded 72KB
Uploaded 73KB
Uploaded 74KB
Uploaded 75KB
Uploaded 76KB
Uploaded 77KB
Uploaded 78KB
Uploaded 79KB
Uploaded 80KB
Uploaded 81KB
Uploaded 82KB
Uploaded 83KB
Uploaded 84KB
Uploaded 85KB
Uploaded 86KB
Uploaded 87KB
Uploaded 88KB
Uploaded 89KB
Uploaded 90KB
Uploaded 91KB
Uploaded 92KB
Uploaded 93KB
Uploaded 94KB
Uploaded 95KB
Uploaded 96KB
Uploaded 97KB
Uploaded 98KB
Uploaded 99KB
Uploaded 100KB
Uploaded 101KB
Uploaded 102KB
Uploaded 103KB
Uploaded 104KB
Uploaded 105KB
/Vegetrade/test.jpg, Success=true
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Sorry Donmanfred for my bad english.:(
This is my log.
You did initialize with ASCIIfile = TRUE. THIS IS THE PROBLEM! You are NOT uploading a textfile. Change it to false and try again.
Expect this to be my last answer.

I´m not interested in helping people which are unable to read and unterstand the docu. Even not if they get told the answers.
My suggestion; learn english
 
Last edited:
Upvote 0
Top