Error: werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'file1'
Code:
<form id="send" action="" method="post" enctype="multipart/form-data" > <div class="profile-pic"> <img src="" id="photos" /> <input type="file" id="files" name="file1" /> <label for="file" id="uploadBtns">Choose Photo</label> </div> <div class="profile-pic-div"> <img src="" id="photo" /> <input type="file" id="file" name="file2" /> <label for="file" id="uploadBtn">Choose Photo</label> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>
when i tried to access file1 using flask it gives me that error.
@app.route('/predict', methods=['POST', 'GET']) def predict(): img1 = request.form['file1']
https://stackoverflow.com/questions/65413461/werkzeug-exceptions-badrequestkeyerror-file1 December 23, 2020 at 01:51AM
没有评论:
发表评论