Logo Search packages:      
Sourcecode: zope-extfile version File versions

def zope-extfile-1.4.2::ExtFile::ExtFile::manage_file_upload (   self,
  file = '',
  content_type = '',
  REQUEST = None 

Upload file from file handle or local directory 

Definition at line 410 of file ExtFile.py.

00410                                                                         :
        """ Upload file from file handle or local directory """
        if self.wl_isLocked():
            raise ResourceLockedError, "File is locked via WebDAV"
        if type(file) == types.StringType:
            cant_read_exc = "Can't open: "
            try: file = open(file, 'rb')
            except: raise cant_read_exc, file
        if content_type:
            file = HTTPUpload(file, content_type)
        self.content_type = self._get_content_type(file, file.read(100), 
                            self.id, self.content_type)
        self._register()    # Register with TM
            new_fn = self._get_ufn(self.filename)
            self._update_data(file, self._temp_fsname(new_fn))
        finally: self._dir__unlock()
        self.filename = new_fn
        if REQUEST is not None:
            return self.manage_main(self, REQUEST, manage_tabs_message='Upload complete.')                

    security.declareProtected(ChangePermission, 'manage_http_upload')
    def manage_http_upload(self, url, REQUEST=None):

Generated by  Doxygen 1.6.0   Back to index