I think I have good news: I tried trunk version instead and the upload of a 300 mb file worked perfectly!
I was using the stable 2.2.1 version until now. I use web2py in a production server with other websites online. Is it safe to use trunk version for the final web? Or should I wait for the stable version to upgrade instead of using the trunk? Thanks a lot for all your time. Sexta-feira, 30 de Novembro de 2012 16:11:48 UTC, Paulo escreveu: > > Hi! > > I'm trying to create a very simple upload field, without any complex > mechanism. A user just uploads a file to a folder in the server (apache), > without web2py changing the file name, and without any db. I have some > dozens of files already in a folder in the server, I just need an upload > form to send new files easly, without having to go personally with an Usb > Pen to the server to copy new files. > > But I'm having an hard time doing it, and dont know why. With small files > (2mb docx file) it works perfectly. But when uploading a 300mbs wav file it > gives an error ticket: > <type 'exceptions.MemoryError'> > TRACEBACK > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > 14. > 15. > 16. > 17. > 18. > 19. > 20. > 21. > 22. > 23. > 24. > 25. > 26. > 27. > 28. > 29. > 30. > 31. > 32. > > Traceback (most recent call last): > File "D:\web2py\gluon\restricted.py", line 212, in restricted > exec ccode in environment > File "D:/web2py/applications/Upload_Fala_Bracarense/controllers/default.py" > <https://cehum.ilch.uminho.pt/admin/default/edit/Upload_Fala_Bracarense/controllers/default.py>, > line 121, in <module> > File "D:\web2py\gluon\globals.py", line 188, in <lambda> > self._caller = lambda f: f() > File "D:/web2py/applications/Upload_Fala_Bracarense/controllers/default.py" > <https://cehum.ilch.uminho.pt/admin/default/edit/Upload_Fala_Bracarense/controllers/default.py>, > line 28, in index > form = SQLFORM.factory(Field('myfile', 'upload', > uploadfolder='/static')).process() > File "D:\web2py\gluon\html.py", line 2170, in process > self.validate(**kwargs) > File "D:\web2py\gluon\html.py", line 2109, in validate > if self.accepts(**kwargs): > File "D:\web2py\gluon\sqlhtml.py", line 1281, in accepts > **kwargs > File "D:\web2py\gluon\html.py", line 2022, in accepts > self._traverse(False, hideerror) > File "D:\web2py\gluon\html.py", line 842, in _traverse > newstatus = c._traverse(status, hideerror) and newstatus > File "D:\web2py\gluon\html.py", line 842, in _traverse > newstatus = c._traverse(status, hideerror) and newstatus > File "D:\web2py\gluon\html.py", line 842, in _traverse > newstatus = c._traverse(status, hideerror) and newstatus > File "D:\web2py\gluon\html.py", line 842, in _traverse > newstatus = c._traverse(status, hideerror) and newstatus > File "D:\web2py\gluon\html.py", line 853, in _traverse > self._postprocessing() > File "D:\web2py\gluon\html.py", line 1762, in _postprocessing > _value = str(self['_value']) > File "C:\Python27\Lib\cgi.py", line 515, in __repr__ > self.name, self.filename, self.value) > MemoryError > > IN FILE: > D:\WEB2PY\APPLICATIONS\UPLOAD_FALA_BRACARENSE\CONTROLLERS/DEFAULT.PY > I have tried a lot of diferent ways. I have read everything I could find > in the web. I found a topic with the same problem but no solution I could > use. Anyone can help with some tips? > > This the code in the controller: > > import os > > def index(): > form = FORM(INPUT(_type='file',_name='myfile'),INPUT(_type='submit')) > if form.accepts(request.vars,session): > > open(os.path.join(request.folder,'uploads','filename.wav'),'wb').write(form.vars.myfile.file.read()) > return dict(form=form) > > I have tried a lot of different ways, this only an example. I used > SQLFORM.factory {form = SQLFORM.factory(Field('myfile', 'upload', > uploadfolder='/static')).process()}, shutil > {shutil.copyfileobj(request.vars.myfile.file,open(os.path.join(request.folder,'static','filename.txt'),'wb'))}, > > and a lot of different code variants but none worked. Its allways the same: > with small files it works, with a 200mb file it gives an error. > > > Anyone can help me understand this problem? The max file size I need to > upload is 500mb. It will be used by only one person, with a login, so there > is no need to a complex mechanism, and files need to mantain the same name. > I just need the upload to work. > > Thanks and sorry for my bad english. > > > > > I want a user to be able to upload a file to a directory in the server > (apache), without changing the file name, and wihout databases. A simple > and direct upload, so a friend of mine can store some files in > --