Re: Using WebObjects to upload very large files
Re: Using WebObjects to upload very large files
- Subject: Re: Using WebObjects to upload very large files
- From: Jonathan Rochkind <email@hidden>
- Date: Mon, 23 Feb 2004 11:07:36 -0600
I don't think WOLongResponse is going to work for you here.
WOLongResponse is tricky in general. Understanding what points a WO
app will lock/block (depending on WO app configuration) is also
tricky, and interacts with how your WOLongResponse will work---in
this case, it spoils everything.
Here is some info for you:
1. You need to use the 'streaming' APIs that were added to WO
5.2.?(forget exactly which). This will allow you to stream the file
direct to disk, so as not to consume memory, as Martin wants.
You actually _can't_ see exactly how big the uploaded file is before
you've streamed the whole thing---this is a (stupid) limitation of
HTTP, and has nothing to do with WO. Size of the uploaded file is
not included in the mime sub-part headers for the uploaded file. You
_can_ estimate the size of the file by looking at the size of the
HTTP request as a whole---which includes the file data as wel as
other stuff.
Getting a progress bar to work is actually quite tricky, due to other
issues involving blocking---Ordinarily, WO enforces
one-thread-at-a-time access to a session (and unless you turn on
concurrent request handling, one-thread-at-a-time request-response in
general, even among several sessions). . So, while an upload is in
progress (meaning an HTTP request is in progress of being sent), it's
problematic to make _another_ HTTP request to update a progress bar.
But, I've written code to provide a progress bar, and made it
publically available. It's really tricky code; I've been using it
myself for a while, and it seems to work without problems, but use at
your own risk. I made it as flexible as possible, but like I said,
it was very tricky to get working, and does need to be used in
certain ways. See:
http://wocode.com/cgi-bin/WebObjects/WOCode.woa/wa/ShareCodeItem?itemId=306
At 11:43 AM -0500 2/21/04, Karl Gretton wrote:
Hi,
WO provides the WOLongResponse exactly for this purpose. The
concept is that you spawn a thread to handle the upload in the
background and then refresh a status page showing progress.
There is an example shipped with WO (On MacOS X at least) called
LongRequest that illustrates this.
Karl
On Feb 21, 2004, at 4:37 AM, Martin Tonks wrote:
I have a web based WO project where the users will need to regularly upload
very large files (30 to 60MB per file would be typical). What I would really
like to achieve is for the user to be able to select the file for uploading
from their local file system, the application then identifies the size of
the file and whilst the file is being uploaded (direct to disk so as not to
consume vital memory server) report back to the user is state of
completeness. In essence FTP using WO.
Any suggestions?
Martin
ZAP FACTOR
www.zapfactor.com | t: 01308 420 184 | m: 07811 944 883 | e:
email@hidden
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.