Example #1
0
def upload_flash(request):
    """
    Helper function that processes the file upload.  Used by flash player.
    
    :Return: HttpResponse of 0 or 1
    """

    try:
        if (request.method == 'POST' and 'file_upload' in request.FILES
                and 'slug' in request.GET):
            upload = File()
            upload.file_upload = request.FILES['file_upload']
            upload.submission = Submission.objects.get(
                slug=request.GET['slug'])
            upload.save()
            return HttpResponse(1)

        else:
            return HttpResponse(0)

    except StopUpload:
        raise

    except:
        return HttpResponse(0)
Example #2
0
def upload_html(request, submission):
    """
    Helper function that processes the file upload.  Used by the 'no flash' version.
    
    :Return: Void
    """
    
    if request.FILES:
        for file in request.FILES:
            upload = File()
            upload.submission = submission
            upload.file_upload = request.FILES[file]
            upload.save()
            
    return
Example #3
0
def upload_html(request, submission):
    """
    Helper function that processes the file upload.  Used by the 'no flash' version.
    
    :Return: Void
    """

    if request.FILES:
        for file in request.FILES:
            upload = File()
            upload.submission = submission
            upload.file_upload = request.FILES[file]
            upload.save()

    return
Example #4
0
def upload_flash(request):
    """
    Helper function that processes the file upload.  Used by flash player.
    
    :Return: HttpResponse of 0 or 1
    """
    
    try:
        if (request.method == 'POST' and 'file_upload' 
            in request.FILES and 'slug' in request.GET):
            upload = File()
            upload.file_upload = request.FILES['file_upload']
            upload.submission = Submission.objects.get(slug=request.GET['slug'])
            upload.save()
            return HttpResponse(1)
        
        else:
            return HttpResponse(0)
    
    except StopUpload:
        raise

    except:
        return HttpResponse(0)