On 29 Cze, 22:15, umrzyk <[EMAIL PROTECTED]> wrote: > hi there, > i would like to give my users ability to upload a huge (i.e. 10-20 MB) > files, mostly images. standard uploading using django newforms and > FileField is at the moment not an option. it kills my > server immediately. recently i read about streaming upload, and.. wow, > that's it! so i patched my django sources with 2070-r7728.patch (no > conflicts) and gave it a try. here are the problems: > > - for small files (i didn't check what is a small file, i guess it's > something < 2.5MB as mentioned in doc) i got a validation message: > "the > submitted file is empty" > > - for larger files (i tried 11MB) i got an error from server: "413 > Request Entity Too Large" > > i'm sure i'm doing something wrong, actually i'm the beginner. could > you > suggest where should i start searching? Or could you help me with a > sample snippet that would upload the file in a given directory? > > running server is nginx 0.7.1 with mod_wsgi > > thanks, > jm.
guys, i have just set up apache (with mod_wsgi) to verify this issue and it occured that django complains about empty submitted file independently from running server. so I guess somethig is wrong with either my code (most probably...) or with the patch. Once again, the problem is that i cannot upload small files (request body hold in memory). form validator returns immediately "the submitted file is empty" message in this case. large files upload without any problems. my form code: class ArticleForm(forms.Form): title = forms.CharField(max_length=100) content = forms.FileField() def save(self,commit = True,user=None,f=None): article = Article(created=user, content=f) if commit: article.save() return article view code: def workspace(request): if request.method == 'POST': form = ArticleForm(request.POST, request.FILES) if form.is_valid(): article = form.save(user=request.user,f=request.FILES['content']) else: form = ArticleForm() return render_to_response('workspace.html', {'user': request.user, 'form': form}) and models code: class Article(models.Model): title = models.CharField(max_length=100) content = models.FileField(upload_to="articles") any suggestions what is wrong here? thanks, jm. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---