file uploads and progress monitoring on on-rev(reposted )

Andre Garzia andre at andregarzia.com
Mon Nov 29 11:37:44 EST 2010


Martin,

Lots of things happening here.

$_SERVER variable is ONLY AVAILABLE for RevServer which is exactly what you
are using.

$_POST_RAW just means you are accessing the stuff in the standard input in
its original form, you need this when you must recreate data on the correct
order since $_POST will not preserver order or when you need to do MIME
Decoding which is the case of file uploads.

Now on the topic of file upload progress, the quick answer is no. You can't
provide your page with a file upload progress bar if you are using an simple
HTML Form for the file upload. If you built your web page and use something
along the lines of:

<input type="file" ... />

Then you can't check for progress. The web is stateless. When your client is
uploading data, your server can't modify what your client is seeing. That is
not how it works.

You will say that gmail and other guys show you a progress bar. How they do
it? They cheat. Most of these guys are using a hidden adobe flash component
to do the upload and inform back the progress or even worse, all the upload
interface thing is a flash blob. This approach involves using two additional
technologies: Flash and JavaScript to bind everything together. Non trivial
to implement.

Other approach is to go javascript crazy and use httprequest or websockets
to connect and somehow pipe the data but I think that a javascript only
approach is hard because there is no file reading routine in javascript. You
could use a hidden iframe with a form and then submit the form, while the
content is read by your server you could write the progress somewhere and
then on the non hidden page you use javascript to pool for this progress
thus updating the screen. This is a javascript only solution but I don't
think it is worth pursuing and like all javascript solutions you will spend
an eternity debugging it for all browsers.

andre



More information about the use-livecode mailing list