This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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
It's not a secret anymore!