I'm currently trying to allow users to upload photos to my site.

They will be sent to /upload to upload a photo which will (if the upload is 
successful) take them to /edit/ where they will enter the name and tags to 
the photo.

However, when I upload a 3.6MB .jpg to the site, I keep getting the above 

See the code below, any tips?


def upload_photo(request):
 if not request.user.is_authenticated:
 return redirect('photos:login_user')

 if request.method == 'POST':

 form = PhotoUploadForm(request.FILES)

 if form.is_valid():

 newphoto = form.save()
 return redirect('photos:single_photo', photo_id=newphoto.id)

 return HttpResponse()


 form = PhotoUploadForm()
 return render(request, 'photos/uploadphoto.html', context={'form': form})


{% block content%}

<form method="post" action="">
    {% csrf_token %}
    {% for field in form %}
    <div class="form-group">
        <div >
            <span class="text-danger small">{{ field.errors }}</span>
        <label class="control-label">{{ field.label_tag }}</label>
        <div>{{ field }}</div>

            <button type="submit" class="btn btn-success">Submit</button>
{% endfor %}

{% endblock %}

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to