Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Upload memory data instead of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload memory data instead of file" Watch "Upload memory data instead of file" New topic

Upload memory data instead of file

Chris Wang
Ranch Hand

Joined: Jan 13, 2004
Posts: 34

I have a third-part servlet which will deal with a jsp's upload control. In my jsp page I got a string data that the servlet needs. Can I simulate a file upload control in my jsp page to submit the string data to the servlet insteat of creating a real local file, which i have to browse it and delete it later?

Thanks in advance.
[ April 25, 2005: Message edited by: chris wang ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Are you saying you want the browser to trick the server into thinking it's sending a file when it's just sending a string from memory?
I doubt you'll find a way to do that.

The Javascript XMLHttpRequest object does allow you to set request headers.
You might want to play around with that to see if you can spoof a multipart form request. Could be fun to try.

The folks in the HTML/Javascript forum might be able to give you more information on it.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Upload memory data instead of file
jQuery in Action, 3rd edition