So im working on file upload feature which uploads a png file to a Net app NAS and Accessing this NAS share on a VM requires that i add an export, this will grant the VM permission to mount the storage.
After completeing the steps and adding a mount point when i try to upload a file using the below code
import jcifs.smb.SmbFileOutputStream;
@RestController
public class FileUploadController {
@PostMapping("/upload")
public String uploadFile(@RequestParam("file") MultipartFile file) {
String nasUrl = "smb://your-nas-address/path/to/directory/";
String username = "your-username";
String password = "your-password";
try {
String destinationUrl = nasUrl + file.getOriginalFilename();
SmbFile smbFile = new SmbFile(destinationUrl, new jcifs.smb.NtlmPasswordAuthentication(null, username, password));
SmbFileOutputStream smbFileOutputStream = new SmbFileOutputStream(smbFile);
smbFileOutputStream.write(file.getBytes());
smbFileOutputStream.close();
return "File uploaded successfully!";
} catch (Exception e) {
e.printStackTrace();
return "File upload failed: " + e.getMessage();
}
}
}
i get this erorr
Error at index 0 in: "C2C_lkasdlajsdlkasjd6676q3e2qubd"
Since I’m a beginner any guidance on this will be helpful