1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| @bp.route('/upload', methods=['POST']) @login_required def upload(): uploaded_file = request.files.get('file')
suffix = '.' + uploaded_file.filename.split('.')[-1] filename = uploaded_file.filename.replace(".", "").replace("\\", "").replace("/", "") basedir = os.path.abspath(os.path.dirname(__file__)).replace("blueprints", "") new_dir = os.path.join("static", "big_data_upload", filename + str(int(time.time())) + suffix) uploaded_file_path = os.path.join(basedir, new_dir) uploaded_file.save(uploaded_file_path) size = os.path.getsize(uploaded_file_path) print(size)
return "success"
|