skoczen/django-ajax-uploader

Bug with commit #80a5a9d7bd24528e069ed123369ce8c7e5569ff0

diegueus9 opened this issue · 10 comments

I've already install this app, but when i load the template i get this error:

Uncaught TypeError: Cannot set property 'innerHTML' of null
qq.FileUploaderfileuploader.js:529
(anonymous function):8000/ajax_upload/:7

I just follow the instructions, the template is the same in example and code, the view is this;

def upload_profile_photo(request):
    csrf_token = get_token(request)
    data = {'csrf_token': csrf_token}   
return render_to_response('venue_profile_photos/index.html', data, context_instance=RequestContext(request))

upload_profile_photo_send = AjaxFileUploader()

My webbrowser is google chrome 16.0.891.0 dev but neither works with firefox 6.0.2

Any thoughts?

Hm, haven't ever seen that before - will take a look.

The error is on the first reference to your HTML element.

Odds are most likely that the line in your template of

 element: $('#file-uploader')[0],

doesn't point to a valid element. If you've set up the page identically, I'd most strongly guess that you haven't included jQuery.

I can swear to you I do:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" ></script>

I tried too with:

element: document.getElementById('file-uploader'),

but doesn't work neither

I completely believe you. The error you're reporting is in that element line though. Can you post your full HTML page?

There's no element: in that paste - I assume you pulled it? Everything else looks sane at first glance.

I moved for debug porposals, remember when I said that I use:

element: document.getElementById('file-uploader'),    

Got it. I'm setting up a test project shortly, will let you know what I find.

Ahh. Yeah, the page hasn't been loaded when that code runs. Either trigger it with onload, or wrap it in a

$(function(){

// code

});

I'll update the readme shortly.

Readme updated.