Android Question FTP Server Invalid Path

Blueforcer

Well-Known Member
Licensed User
Longtime User
Im using the B4X FTP Server in my B4A App.
BaseDir is Files.DirInternal.

Connection and directory/file listing is working, but i cannot do more.
Download, Upload, Deleting and Directory change is not possible.
I always get an Invalid path error
e.g from a filedelete in filezilla (in passive mode)
Status: Connecting to 192.168.178.25:51041...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Status: Logged in
Status: Deleting "/button-eco-betrieb-ein.png"
Command: CWD /
Response: 450 Invalid path:
Command: DELE /button-eco-betrieb-ein.png
Response: 500 Invalid path

In the Sub HandleClientCommand i get DELE as command and /button-eco-betrieb-ein.png as parameter.
The Function CombineWithCurrent(parameters) returns an empty string with results in this error message.
I followed this function to NormalizePath
Here the CanonicalPath is /data/data/de.dinotec/files/button-eco-betrieb-ein.png and it is compared to the startingstring of BaseDir wich is /data/user/0/de.dinotec/files
So this Comparison fails because of a complete different folder i think

Where does it come from?
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
Ok, it looks like the error depends on the device.
On the Huawei P30 Pro it doesnt work.
But it works on the Samsung Galaxy Tab S7+

can you imagine what differences there might be?
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
Log is inconspicuous
Huawei:

client: AUTH TLS
client: AUTH SSL
client: USER service
client: PASS kmze
User logged in: service
client: OPTS UTF8 ON
client: PWD
client: TYPE I
client: PASV
client: LIST
client: DELE bodenduese.jpg

Samsung outputs the same

Also no error in unfiltered logs
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
On the Samsung Tab there is also no CWD command and its working.
Right now the device is the only difference.
same ftp client, same app, same settings but different device.
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
Today weve got our development HMI Panels with Android 7.1.2.
Here we have the same problem.
what can i do to isolate the problem?
 
Upvote 0

amorosik

Expert
Licensed User
Upvote 0

josejad

Expert
Licensed User
Longtime User
Where to find an updated document/post of which memory areas are available on Android,

you should start a new thread to not mesh the OP post, but here you have some advices




tips 8 - 10
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
I still have the problem and unable to fix it.
I tried 4 different devices

I also tried differend computers, FTP-Clients and disabled my firewall

I test all with the unmodified example app:

B4X:
Status:    Connecting to 192.168.178.24:51041...
Status:    Connection established, waiting for welcome message...
Status:    Insecure server, it does not support FTP over TLS.
Status:    Logged in
Status:    Retrieving directory listing...
Status:    Directory listing of "/" successful
Status:    Connecting to 192.168.178.24:51041...
Status:    Connection established, waiting for welcome message...
Status:    Insecure server, it does not support FTP over TLS.
Status:    Logged in
Status:    Starting upload of C:\Users\Stephan\Desktop\trend.png
Command:    CWD /
Response:    450 Invalid path:
Command:    MKD /
Response:    500 Invalid path
Command:    CWD /
Response:    450 Invalid path:
Command:    SIZE /trend.png
Response:    500 Invalid path
Command:    MDTM /trend.png
Response:    450 Invalid path:
Command:    TYPE I
Response:    500 Invalid path
Error:    File transfer failed


The only thing (Besides my investigation in the frist port) i noticed:
If i connect tha app says "Number of Clients: 1"
When i want to start a upload it increases to 2
and upload fails after that
 
Last edited:
Upvote 0

Mihai Rainer Jr.

Member
Licensed User
I know a little late, but for future searches:
Tested with hard codded BaseDir (something like /data/data/<package_name>/files) and is working fine.
My tests were performed on a rooted Android device, don't have any non-rooted to check.
But it worked for my purposes.
Using DirInternal returns exactly the errors you have mentioned above.
 
Upvote 0
Top