Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Upload image to server

Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
     Greetings to all!

     JSP code:

in Servlete-code

    IO-code in ImageService-class

  As a resulte:
1. In log:
- stream to servlet without problem
- Buffer is not null
- Temporary is not null
- request is not null
- fileOutputStream is not null

2. In "newimage"-directory new file is creating. For example: "Picture147".
  But this file IS EMPTY....

  So, html/js send  a file on server,  servlet receives it with request ("stream to servlet without problem"), ImageService serialize it and creates a new file.
  But serialized data is not saved in this new file!

  Additionally:  size of image-file, wich i try to save from web-page to server has a size: 250 × 188


Posts: 1170
IntelliJ IDE Hibernate Firefox Browser MySQL Database Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you way easier using a multipartfile to pass your file to your controller
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic