• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Upload image to server  RSS feed

 
Ranch Hand
Posts: 66
  • 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
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you way easier using a multipartfile to pass your file to your controller
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!