Am 30.11.2006 um 14:26 schrieb Paul Childs:
> > I have been investigating file uploads in general and also with Django > in mind. This thread gave me a place to start: > http://tinyurl.com/ymzmds > <http://groups.google.com/group/django-users/tree/browse_frm/thread/ > 7b8d81917f741eea/6025c02beec9ae29?rnum=1&q=maximum+upload > +size&_done=%2Fgroup%2Fdjango-users%2Fbrowse_frm%2Fthread% > 2F7b8d81917f741eea%3Ftvc%3D1%26q%3Dmaximum+upload+size% > 26#doc_6025c02beec9ae29> > > I have a few questions.. > > 1. Is there an upper limit to the size of files that one can upload to > Django? I am able to upload files of about 5 MB or less with no > problems, but when I try to upload a file (to the Django dev server) > which is larger I get an error message from Django. (Traceback is > below) since you´re uploading to your server (and not to django), you have to use the apache-config (if you´re using apache): see http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody > > 2. Does anyone know of a *simple* client-side javascript that would > enable client side checking of a file's size? I have seen quite a few > progress bars which have way more features than I need. I would just > like to put a cap on the size of an uploaded file and stop the upload > *before* the whole file is sent to the web server and handed over to > the view. I don´t think that´s possible. you can get the filesize after uploading, but not before. there have been other threads concerning this topic. doing a "search" on the django user-group might help. patrick > > Thanks, > /Paul > > Traceback (most recent call last): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \servers\basehttp.py", > line 272, in run > self.result = application(self.environ, self.start_response) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \servers\basehttp.py", > line 615, in __call__ > return self.application(environ, start_response) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 148, > in __call__ > response = self.get_response(request.path, request) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\base.py", > line 102, > in get_response > return self.get_technical_error_response(request) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\base.py", > line 134, > in get_technical_error_response > return debug.technical_500_response(request, *sys.exc_info()) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\views > \debug.py", > line 131, in tec > hnical_500_response > return HttpResponseServerError(t.render(c), mimetype='text/html') > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 155, > in render > return self.nodelist.render(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 688, > in render > bits.append(self.render_node(node, context)) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 716, > in render_node > raise wrapped > TemplateSyntaxError: Caught an exception while rendering: > > Original Traceback (most recent call last): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 706, > in render_node > result = node.render(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 752, > in render > output = self.filter_expression.resolve(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 548, > in resolve > obj = resolve_variable(self.var, context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 634, > in resolve_variable > current = current[bits[0]] > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\http > \__init__.py", > line 31, in __ > getitem__ > for d in (self.POST, self.GET): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 99, > in _get_post > self._load_post_and_files() > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 77, > in _load_post_and_files > self._post, self._files = http.parse_file_upload(header_dict, > self.raw_post_data) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 122, > in _get_raw_post_data > self._raw_post_data = > self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"])) > File "C:\Python24\lib\socket.py", line 303, in read > data = self._sock.recv(recv_size) > MemoryError > > [30/Nov/2006 13:06:24] "POST /doc/update/49/ HTTP/1.1" 500 3110 > Traceback (most recent call last): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \servers\basehttp.py", > line 2 > 72, in run > self.result = application(self.environ, self.start_response) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \servers\basehttp.py", > line 6 > 15, in __call__ > return self.application(environ, start_response) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 148, > in __call__ > response = self.get_response(request.path, request) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\base.py", > line 102, > in get_response > return self.get_technical_error_response(request) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\base.py", > line 134, > in get_technical_error_response > return debug.technical_500_response(request, *sys.exc_info()) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\views > \debug.py", > line 131, in tec > hnical_500_response > return HttpResponseServerError(t.render(c), mimetype='text/html') > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 155, > in render > return self.nodelist.render(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 688, > in render > bits.append(self.render_node(node, context)) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 716, > in render_node > raise wrapped > TemplateSyntaxError: Caught an exception while rendering: > > Original Traceback (most recent call last): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 706, > in render_node > result = node.render(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 752, > in render > output = self.filter_expression.resolve(context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 548, > in resolve > obj = resolve_variable(self.var, context) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\template > \__init__.py", > line 634, > in resolve_variable > current = current[bits[0]] > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\http > \__init__.py", > line 31, in __ > getitem__ > for d in (self.POST, self.GET): > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 99, > in _get_post > self._load_post_and_files() > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 77, > in _load_post_and_files > self._post, self._files = http.parse_file_upload(header_dict, > self.raw_post_data) > File > "c:\python24\lib\site-packages\django-0.95-py2.4.egg\django\core > \handlers\wsgi.py", > line 122, > in _get_raw_post_data > self._raw_post_data = > self.environ['wsgi.input'].read(int(self.environ["CONTENT_LENGTH"])) > File "C:\Python24\lib\socket.py", line 303, in read > data = self._sock.recv(recv_size) > MemoryError > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---