upload_3_4.py 759 B

123456789101112131415161718192021222324252627
  1. def uploadFile(self, file, ident, ftype, id=0, linkonly=0):
  2. bdata = ""
  3. for l in file.file.readlines():
  4. bdata += l
  5. filename = file.filename.split("\\")
  6. filename = filename[-1:][0]
  7. ns = {'site': self,
  8. 'BASE_URL': getConfig().BASE_URL,
  9. 'ident': ident,
  10. 'id': id,
  11. 'filename': filename,
  12. 'ident_id': makeLinkAble(ident),
  13. 'linkonly': linkonly,
  14. 'ftype': ftype}
  15. ns['data'] = bdata
  16. if model.Files.countFilesWithFilename(filename):
  17. ns['new_filename'] = model.Files.newFilename(filename)
  18. amiweb.session()['upload_ns'] = ns
  19. return render("skeletonz/plugins/upload/view/upload_already_found.tmpl", ns)
  20. return self.uploadComplete(ns)