I am trying to upload file. the abnormal is 'The method is not allowed for the requested URL' after run . However my code is request methods is 'POST'
This is my a part of html:
input type="submit" value="upload" id="submit">
This is my api code and run result:
@api.route('/upload', methods=['POST','GET']) def upload(): if request.method == 'POST': print '-'*100 print request.files f = request.files['file'] upload_path = os.path.join(APP_STATIC_TXT, secure_filename(f.filename)) file.save(upload_path) return redirect(url_for('/upload'))
This is web run result: