• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Upload image to server

 
Ranch Hand
Posts: 123
  • 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

   




 
Rancher
Posts: 1170
18
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
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic