I have a java code to upload a image in local drive . now I want when a user upload a image it should we upload on remote location how can i achive it ...
try {
String UPLOAD_DIRECTORY = "E:\\uploaded";
File uploadsFolder = new File(UPLOAD_DIRECTORY);
String fileName = item.getName();
if (fileName != null) {
fileName = FilenameUtils. getName(fileName); // uploaded file filename
}
File uploadedFile = new File(uploadsFolder, fileName);
item.write(uploadedFile);
/// Save a list with the received files
receivedFiles.put(item.getFieldName(), uploadedFile);
receivedContentTypes.put(item.getFieldName(), item.getContentType());
/// Send a customized message to the client.
response += uploadedFile;
} catch (Exception e) {
throw new UploadActionException(e);
}