aspose file tools*
The moose likes Applets and the fly likes More on emulating HTTP file upload with an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "More on emulating HTTP file upload with an applet" Watch "More on emulating HTTP file upload with an applet" New topic
Author

More on emulating HTTP file upload with an applet

Jaime Lannister
Greenhorn

Joined: Mar 30, 2005
Posts: 18
Re: My last post. Thanks for suggesting O'Reilly, but unless I'm missing something that won't work. They only have servlets and other code for use on the server. However, I am working under the following constraints:

1) For the forseeable future I am stuck on a shared server that does not support Java servlets or any other server side Java. It does, however, support PHP, and I am familiar with PHP, hence my desire to use of it at the server end.

2) PHP easily handles http POST file uploads of any type of file, and does various types of file manipulation. Hence my interest in emulating http uploads.

3) My eventual goal is to have a capabilty where random, casual visitors to a website will be able to click on an applet button and upload short statements spoken into their microphone into files on the server. These visitors cannot be expected to download special software for this, hence my interest in applets.

Anyway, I am starting to experiment with (3) by trying to "fool" the PHP code into thinking that a simple line of text preceeded by the right http headers is really a file. Several sources say you can do this, even for random byte streams such as are generated by audio, images, etc.
I have 90% - 95% of the rest of the "parts" I need in the form of applets that will record from the microphone into files or memory, play back the recordings, PHP that will handle the files at the other end, etc.

I think that what I might really need at this point is some method of looking at the information that is being sent from my machine to the server either as it leaves my machine or (better yet) arrives at the server. That way I could compare the header info, etc. that I am sending out to what a real http form spits out, and figure out where the error is. Does anyone know how to do this? One person who had the exact same problem I do used a "packet sniffer" for this purposer but I don't know anything about them.

Also, since last night I have found a few more discussions and sample code for this type of thing, and located some errors (I think) in the header info in the code I posted then (in the position of newline statements (\r\n)), but still no luck. If anyone wants to take a look at the new version I'd be happy to get a new set of (more experineced) eyes on it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: More on emulating HTTP file upload with an applet