Don't use obsolete django.utils.simplejson library.
Add permission checks.
Removed unused import.
Reorganize upload code.

* Split into upload.js
* Also initial upload parameters received via AJAX request.
Delete temp file on exception.
Generate thumbnails on new uploaded images.