Android Question File corrupted after upload

PumaCyan

Member
Licensed User
I tried to upload a file using ftp as in the tutorial here : This Thread

1.png
2.png


file uploaded successfully...
however, when the file is opened it becomes corrupted like this. is there any additional code so the file doesn't look like this?

3.png
 

PumaCyan

Member
Licensed User
I have not used ftp for a while, but I remember when you upload an image the fileUpload line should have False not true

So are there any alternatives for uploading files? can you provide a reference link / thread?
My upload log results say success = true
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
My upload log results say success = true
Just replace true with false in this line:
Instead of: FTP.UploadFile(File.DirInternal, "1.txt", True, "/somefolder/files/1.txt")
use:
FTP.UploadFile(File.DirInternal, "yourimage.jpg", False, "/somefolder/files/yourimage.jpg")
True is when upload a text file, False if for other type of file. Did you try it
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
B4X:
oFTP.UploadFile(File.DirInternal, "testfile.jpg", False, "MySeverPath/testfile.jpg")

If you still have issues , maybe post some code ...
 
Upvote 0

PumaCyan

Member
Licensed User
Just replace true with false in this line:
Instead of: FTP.UploadFile(File.DirInternal, "1.txt", True, "/somefolder/files/1.txt")
use:
FTP.UploadFile(File.DirInternal, "yourimage.jpg", False, "/somefolder/files/yourimage.jpg")
True is when upload a text file, False if for other type of file. Did you try it

B4X:
oFTP.UploadFile(File.DirInternal, "testfile.jpg", False, "MySeverPath/testfile.jpg")

If you still have issues , maybe post some code ...

wow ..
This is successful, so the keyword is from true or false...
Thank you very much for your help @Mahares @mangojack
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
This is successful, so the keyword is from true or false...

- The AsciiFile parameters sets the file transfer mode. If AsciiFile is True then every occurrence of an end of line character will be translated based on the server native end of line character. If your FTP server is Unix or Linux then the end of line character is the same as Android.
In most cases you can set AsciiFile to False.



 
Upvote 0
Top