This forum is a community forum meant for users of the plugin to collaborate and help solve issues with implementation, etc. Unfortunately, as the creator of the plugin, I do not have much time to attend to every request here as this is only a side project and I must work a full-time job to provide for my family. This is how I keep the Flash version free and the HTML5 version low cost.
UploadiFive 1.1.1 has been released which includes a small fix for added support on touch devices including iOS 6 devices.
Implementing Uploadify to a Django project
  • I am writing a new gallery webpage and I wanted to do this in Django instead of PHP which I have always used earlier. Problem is I am completely new to Django and thus, trying to get Uploadify to work with it is no easy task in terms of troubleshooting.

    I found a short guide on these forums by amorris that gave some insight, but it didn't really get me "home safe". My page is currently triggering a javascript error saying "Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'cookie'.

    This is currently my javascript to trigger the whole uploading process in my template for the upload page.

    {% extends 'base/index.html' %}
    {% block stylesheet %}
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}uploadify/uploadify.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script&gt;
    <script type="text/javascript" src="{{ STATIC_URL }}uploadify/jquery.uploadify-3.1.min.js"></script>
    <script type="text/javascript">
    $('#file_upload').uploadify({
    swf: '{{ STATIC_URL }}uploadify/uploadify.swf',
    uploader: '/upload/',
    cancelImage: '{{ STATIC_URL }}uploadify/uploadify-cancel.png',
    checkExisting: false,
    postData: {sessionid: $.cookie('sessionid')},
    auto: true
    });
    </script>
    {% endblock %}
    {% block content %}
    <form>
    <input type="file" name="file_upload" id="file_upload" />
    </form>
    {% endblock %}


    In my urls.py I have a url pattern like so (the app-name is 'gallery'):

    url(r'^upload/', 'gallery.views.upload',name='upload'),


    The views.py file looks like this:

    def upload(request):
    if request.method == 'POST':
    for field_name in request.FILES:
    uploaded_file = request.FILES[field_name]

    #writing the file into destination folder
    destination_path = '/home/teioch/dev/knausbook/knausbook/media/gallery/pictures/%s' % (uploaded_file.name)
    destination = open(destination_path, 'wb+')
    for chunk in uploaded_file.chunks():
    destination.write(chunk)
    destionation.close()

    #indicate that everything is OK for SWFUpload
    return HttpResponse("ok", mimetype="text/plain")
    else:
    #show the upload UI
    return render(request, 'gallery/upload.html',{})


    Amorris' sollution required the use of middleware as well which looks like this in a file swfupload.py:

    from django.conf import settings
    from django.core.urlresolvers import reverse

    class SWFUploadMiddleware(object):
    def process_request(self, request):
    if ((request.method == 'POST') and
    (request.path == reverse('gallery.views.upload')) and
    request.POST.has_key(settings.SESSION_COOKIE_NAME)):
    request.COOKIES[settings.SESSION_COOKIE_NAME] = request.POST[settings.SESSION_COOKIE_NAME]


    In settings.py this middleware has been registered by inputing:

    MIDDLEWARE_CLASSES = (
    [...]
    'gallery.swfupload.SWFUploadMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    )


    After loads of Googling and what not I get the impression that it shouldn't be too hard to get this working, but I just don't have a good enough grasp on Django to see it myself yet.. Anyone got any pointers to this? Anything obvious (or less obvious) I'm doing wrong that you can see? Things I should check and/or look more closely at?