I am currently writing a backend which takes in one or many image/video-files to be uploaded into Azure Blob Storage. I am however struggling to set the Content-Type of the files. The Content-Type is by default set to be "application/octet-stream", but I want to dynamically set them by using the file.getContentType() method.
The code looks like this:
public void uploadToContainer(BlobClient blobClient, MultipartFile file) {
try {
blobClient.upload(file.getInputStream(), file.getSize());
} catch (Exception e) {
//TODO:
// Better error handling
e.printStackTrace();
}
}
Does anyone know how I can accomplish this?