Home > Blockchain >  Preserve metadata for file upload in Spring Boot
Preserve metadata for file upload in Spring Boot

Time:12-02

I'm creating an image upload app where the user can edit image metadata. The current way I'm handling file upload is with multipart file.

fun handleFileUpload(@RequestParam files: Array<MultipartFile>): String {

This works, but I lose access to all file metadata for the images. I'm wondering what the ideal way to do this so I can access metadata? I know the Java.io.File class has metadata access.

I'd prefer to maintain drag and drop functionality on my Angular front end.

CodePudding user response:

File meta data is not image meta data...

In java we can:

  • screenshot of: file upload displaying image meta data using javax.imageio

    And with:

    <dependency>
      <groupId>com.drewnoakes</groupId>
      <artifactId>metadata-extractor</artifactId>
      <version>2.16.0</version>
    </dependency>
    

    We get (with few lines) something more like that:

    screenshot of: file upload displaying image meta data using com.drewnoakes:metadata-extractor

    Thanks to blog for javax.imageio "crawling".

  • Related