I have a Java Rest API Post method that sends an image (InputStream) as a parameter, and I have to save it in a blob column in Oracle.
I need to get the full path (real path) of this InputStream to save this image in database. My code is below.
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail) {
String UPLOAD_FOLDER = "c:/uploadedFiles/"; // my rest api does not have this file, how to get at runtime?
String uploadedFileLocation = UPLOAD_FOLDER + fileDetail.getFileName(); // this line is ok
I would like to do something like this:
String UPLOAD_FOLDER = uploadedInputStream.getRealPathName();
or
String UPLOAD_FOLDER = fileDetail.getRealPathName();