aspose file tools*
The moose likes Servlets and the fly likes Receiving a stream from a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Receiving a stream from a jsp" Watch "Receiving a stream from a jsp" New topic
Author

Receiving a stream from a jsp

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
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

Joined: Jan 10, 2002
Posts: 61756
    
  67

What's in file? And why are you setting the X-Requested-With header? XHR will handle that.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

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

Joined: Oct 16, 2011
Posts: 230
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

Joined: Oct 16, 2011
Posts: 230
Problem solved used getInputStream from request and then used OutputStream to write to a file..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Receiving a stream from a jsp