Write/upload a file using Samba/JCIFS issue (SmbAuthException: Access is denied)

前端 未结 2 488
孤城傲影
孤城傲影 2021-02-01 10:04

So I\'m trying to write a file from android device to windows shared folder. I\'m using latest version of JCIFS and code which displays available network shares works fine. So I

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 10:44

    try with this code

     NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",
                                username, password);
        sharepath = "smb://" + pathtosharefolder + test.txt;  
    
    
     sFile = new SmbFile(sharepath, auth);
        SmbFileOutputStream out = new SmbFileOutputStream(file, true);
        out.write(text.getBytes());
    

    Also check you have share the folder path that you are accessing. Also check it has given write permission to the folder

提交回复
热议问题