I followed this thread for uploading a multipart/form-data file: how-can-i-make-a-multipart-form-data-post-request-using-java. However I couldn't find anything regarding uploading a file from remote server. for example, lets say i have a file here: file://serverIP/folder/subFolder/file.x I can access the file using http as well: http://serverIP/subFoler/file.x
this is piece my code:
File fileToUpload = new File("file://serverIP/folder/subFolder/file.x");
HttpPost request = new HttpPost(fullUri);
HttpEntity multipart = MultipartEntityBuilder.create()
.addTextBody("field1", "yes", ContentType.TEXT_PLAIN)
.addBinaryBody("file", fileToUpload, ContentType.APPLICATION_OCTET_STREAM, fileToUpload.getName())
.build();
request.setEntity(multipart);
after executibg I get java.io.FileNotFoundException: file:\serverIP\folder\subFolder\file.x (The filename, directory name, or volume label syntax is incorrect).
Can someone help me understand what is wrong with the path and why the it converts it to file:\...?