My code currently takes in a file, and saves it to a preset directory, but is it possible to just use the file (read the file) and not save it?
@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
file = request.files['file']
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
return "yatta"
else:
return "file not allowed"
return render_template("index.html")
I have tried both
file.read() and file.stream.read() but the return value of that is empty. I verify that the file exists in the uploaded directory and see that the file is not empty.