B4J Question FTP UploadFile problem

imbault

Well-Known Member
Licensed User
Longtime User
Hi,
Using FTP object, I've got a error
Program started.
true
C:\b4j\sqltocsv\Objects
java.lang.RuntimeException: Error uploading file.
550 Access is denied.
at anywheresoftware.b4a.net.FTPWrapper$2.run(FTPWrapper.java:219)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
/, Success=false
java.lang.RuntimeException: Error uploading file.
550 Access is denied.

While, the same credentials and passive mode on FileZilla uploads like a charm,

Here is the code (simple)
B4X:
    cFile1="BAQ_liste_analyses_L14_S107_150710_112605.csv"
    Log( File.Exists(File.DirApp,cFile1))
    oFTP.Initialize("FTP", FTP_Server, 21, FTP_User, FTP_Password)
    oFTP.PassiveMode = True
    oFTP.UploadFile(File.DirApp, cFile1, True, "/"  )

Does anyone has an idea???
B4J V3.00
jNet Lib V 1.10
 

imbault

Well-Known Member
Licensed User
Longtime User
Thanks Erel, the problem was elsewhere as usual so, I post it, because it could help someone else:
FTP.UploadFile last parameter is ServerFilePath - Full path to file that will be created on the server.
In that case ServerFilePath must contain also the file created on the FTP target site

So working code (is that case) is:

B4X:
cFile1="BAQ_liste_analyses_L14_S107_150710_112605.csv"
    Log( File.Exists(File.DirApp,cFile1))
    oFTP.Initialize("FTP", FTP_Server, 21, FTP_User, FTP_Password)
    oFTP.PassiveMode = True
    oFTP.UploadFile(File.DirApp, cFile1, True, "/" & cFile1  )
 
Upvote 0
Top