Open hiven opened 5 months ago
Do I really have to save my file locally to use TUS?
The code:
@app.route('/upload', methods=['POST']) def upload_file(): if 'file' not in request.files: return jsonify({'error': 'No file part'}) file = request.files['file'] if file.filename == '': return jsonify({'error': 'No selected file'}) tus_client = client.TusClient('http://tusd.tusdemo.net/files/') uploader = tus_client.uploader(file.stream, chunk_size=200) try: # Upload the entire file upload_response = uploader.upload() file_url = upload_response.headers['Location'] return jsonify({'file_url': file_url}) except Exception as e: return jsonify({'error': str(e)})
The error: TypeError: stat: path should be string, bytes, os.PathLike or integer, not SpooledTemporaryFile
Yes, right now uploads with tus-py-client must be backed by a file on disk, so the client can seek around and resume the upload if necessary.
Do I really have to save my file locally to use TUS?
The code:
The error: TypeError: stat: path should be string, bytes, os.PathLike or integer, not SpooledTemporaryFile