File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 60817
    
  65

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: 60817
    
  65

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..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Receiving a stream from a jsp
 
Similar Threads
display of japanese characters in Excel report
Issue with large request data using AJAX
Pass the name of the excel through servlet
Ajax works fine in HTTP but not in HTTPS in FireFox
Vectors passed to a static method?