Maybe thats why.I was using elfinder , which i made web2py integration.
The code is here:


    def __upload(self):
        """Upload files"""
        try: # Windows needs stdio set for binary mode.
            import msvcrt
            msvcrt.setmode (0, os.O_BINARY) # stdin  = 0
            msvcrt.setmode (1, os.O_BINARY) # stdout = 1
        except ImportError:
            pass
###DONE: Fix Upload's Response
        if 'current' in self._request:
            curDir = self.__findDir(self._request['current'], None)
            if not curDir:
                self._response['error'] = 'Invalid parameters'
                return
            if not self.__isAllowed(curDir, 'write'):
                self._response['error'] = 'Access denied'
                return
            if not 'upload[]' in self._request:
                self._response['error'] = 'No file to upload'
                return

            upFiles = self._request['upload[]']
            # invalid format
            # must be dict('filename1': 'filedescriptor1', 'filename2':
'filedescriptor2', ...)
            if not isinstance(upFiles, dict):
                self._response['error'] = 'Invalid parameters'
                return

#            self._response['select'] = []
            total = 0
            upSize = 0
            maxSize = self._options['uploadMaxSize'] * 1024 * 1024 * 1024
            for name, data in upFiles.iteritems():
                if name:
                    total += 1
                    name = os.path.basename(name)
                    if not self.__checkName(name):
                        self.__errorData(name, 'Invalid name')
                    else:
                        name = os.path.join(curDir, name)
                        try:
                            f = open(name, 'wb',
self._options['uploadWriteChunk'])
                            for chunk in self.__fbuffer(data):
                                f.write(chunk)
                            f.close()
                            upSize += os.lstat(name).st_size
                            if self.__isUploadAllow(name):
                                os.chmod(name, self._options['fileMode'])
#
self._response['select'].append(self.__hash(name))
                            else:
                                self.__errorData(name, 'Not allowed file
type')
                                try:
                                    os.unlink(name)
                                except:
                                    pass
                        except:
                            self.__errorData(name, 'Unable to save uploaded
file')
                        if upSize > maxSize:
                            try:
                                os.unlink(name)
                                self.__errorData(name, 'File exceeds the
maximum allowed filesize')
                            except:
                                pass
                                # TODO ?
                                self.__errorData(name, 'File was only
partially uploaded')
                            break

            if self._errorData:
                if len(self._errorData) == total:
                    self._response['error'] = 'Unable to upload files'
                else:
                    self._response['error'] = 'Some files was not uploaded'

            self.__content(curDir, False)
            return

As it has to be in module how can i use Web2py's upload function there? I
will check web2py's upload code.

Thanks a lot.


Oh , also this can you list as appliance for web2py ? I made it a few months
ago and you ask me to make it plugin but i do't know how to make it plugin
so hmm but can run directly as appliance.

http://code.google.com/p/*elfinder*-*web2py*/



On Wed, Nov 3, 2010 at 4:30 AM, mdipierro <[email protected]> wrote:

> web2py was tested extensively with large files (up to 2GB, the max
> browsers can handle) on machines with low memory (256MB).
>
> Can you post the code you use for uploading?
>
> The only way I can see this problem is if you upload into a blob.
>
> On Nov 2, 3:46 pm, Phyo Arkar <[email protected]> wrote:
> > Hello all;
> >
> > If i upload a large file (800 MB) and  closed the browser tab while
> > uploading , it freeze the whole web2py. Anyone have this problem?
> >
> > Tried on Local Web2py. Not without using any http server.
>

Reply via email to