Upload Progress Bar

39 views
Skip to first unread message

Pawel Pilitowski

unread,
Nov 6, 2008, 1:46:09 AM11/6/08
to django...@googlegroups.com
Hi all,

I'm in the process of trying to write an Upload Progress Bar for my app.

I'm using the latest trunk version of Django, mod_python 3.3.1,
Memcached, Apache 2.2.8 prefork, and YUI 2.6.

I cannot seem to access the values stored in the cache during upload
(hoping to retrieve the 'uploaded' value for updating the progress
bar), however I can access them once the file has been successfully
uploaded. Are there issues with this setup that will not allow this,
or is it an issue with my logic?

The code is largely inspired by the http://www.fairviewcomputing.com/
blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/ example.

I've tried to only show what's relevant, and some of the JS is just
there to test the concept.

upload_progress view
http://dpaste.com/89036/

UploadHandler
http://dpaste.com/89037/

YUI JS save method
http://dpaste.com/89038/

I just want to be able to access the cache to return a JSON object
during upload.
Any help would be greatly appreciated.

Cheers

Pawel

Alex Koshelev

unread,
Nov 6, 2008, 3:24:17 AM11/6/08
to django...@googlegroups.com
And what error message do you receive?

Pawel Pilitowski

unread,
Nov 6, 2008, 3:53:54 AM11/6/08
to django...@googlegroups.com
No error message per se, just the value 'null', suggesting that no value is being written to the cache during the upload. 

When I periodically poll the upload progress, with an interval-timed GET request, the value returned is 'null' — the value being returned by o.requestText on the GET request success method. 

I know correct X-Progress-ID gets written to the cache after the upload, for when I remove the cache clean-up  (replacing cache.delete(self.cache_key)  with pass) in the upload_complete method, and call the same GET request after the successful upload, the correct values are returned from the cache.

But obviously, this is of no use, as it gives me data as to the upload's progress.

Thanks in advance

Pawel
Reply all
Reply to author
Forward
0 new messages