Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def upload_(self, file, location):
- filename = secure_filename(file.filename)
- #get extension file
- extension = os.path.splitext(filename)[1]
- filename = str(uuid.uuid4()) + extension
- path = os.path.join(current_app.config[location], filename)
- print file #<FileStorage: u'new.pdf' ('application/pdf')>
- print path #/home/app/static/docs/b567467a-0991-4ee6-9255-28f7257079f9.pdf
- print filename #b2c681f6-7ad1-4fd1-abbd-9cddd7972125.pdf
- file.save(path ,filename)
- return filename
- file.save(path ,filename)
- File "/usr/local/lib/python2.7/dist-packages/werkzeug/datastructures.py", line 2706, in save
- copyfileobj(self.stream, dst, buffer_size)
- File "/usr/lib/python2.7/shutil.py", line 49, in copyfileobj
- buf = fsrc.read(length)
- TypeError: integer argument expected, got 'str'
Add Comment
Please, Sign In to add comment