It is necessary to organize the upload user photo on the site. It is planned in the usual form - transfer with saving the link in the database. Can Tomcat save a photo, if so how? If that correct advice. Thank you in advance.

  • one
    You can perfectly save files both in the file system and in the database as a blob. The first option is certainly easier - Stranger in the Q
  • Just reading this - Mikhail Kolomiets
  • one
    item.write (new File (filename)); - Stranger in the Q
  • one
    Absolute Path - Stranger in the Q

1 answer 1

File saved:

factory.setRepository(new File("/home/mihail/IdeaProjects/Handmaker2/src/main/webapp/images")); 

...

 item.write(new File(factory.getRepository() + "/" + item.getName())); 

Thanks @Stranger in the Q!

  • save this one, and then how to give to the page? This is a slightly different problem. This applies to storage in the database and in the file system. - Vadim