send file to api without storing in directory

Viewed 55

I want to send a file with an HTML form. The API is asking for a directory. How do I send a file without storing it in a directory?

<form action="/" method="post">
  <input type="file" name="file1">
  <input type="submit" value="submit">
</form>
from flask import Flask, redirect, render_template, request

app = Flask(__name__)
@app.route('/', methods=['POST','GET'])
def index():
    file = request.form["file1"]
    upload_file(file)
    return render_template('index.html')
path of file is not valid
0 Answers
Related