Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Receiving a stream from a jsp

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am using a 3rd party library for asynch upload of a file(pic). The JS library sends the file as a data stream



How can i save this file to a physical location path(say d:\pic.jpg)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's in file? And why are you setting the X-Requested-With header? XHR will handle that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technical nit: once the page gets to the browser, it's not a JSP, it's an HTML page like any other. So you are not receiving anything from a JSP, but from an HTML page.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Technical nit: once the page gets to the browser, it's not a JSP, it's an HTML page like any other. So you are not receiving anything from a JSP, but from an HTML page.

Thanks for correcting me. BTW its a 3rd party library and thats how it is in the code. Its a picture file. Basically i am trying to upload a picture from the HTML page asynch. and upload it to a DB.
The JS open source widget allows me to select a file and asynch. send it to the server in this case a servlet.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved used getInputStream from request and then used OutputStream to write to a file..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic