windows python flask上传文件出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'的解决方法
在浏览器中输入时,出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'
http://127.0.0.1:5000/upload
有如下俩种解决方法
1. 第一种
@app.route('/upload',methods=['GET','POST'])
def upload():
if request.method=='POST':
f = request.files['file']
basepath = path.abspath(path.dirname(__file__))
filename = secure_filename(f.filename)
upload_path=path.join(basepath,'static','uploads',filename)
f.save(upload_path)
return redirect(url_for('upload'))
return render_template('upload.html')
2. 第二种
@app.route('/upload',methods=['GET','POST'])
def upload():
if request.method=='POST':
f = request.files['file']
filename = secure_filename(f.filename)
f.save(path.join('static/uploads',filename))
return redirect(url_for('upload'))
return render_template('upload.html')
希望能解决您的问题。
如果有用请点个赞吧!
windows python flask上传文件出现IOError: [Errno 13] Permission denied: 'E:\\git\\test\\static\\uploads'的解决方法的更多相关文章
- 【docker】python: can't open file 'helloworld.py': [Errno 13] Permission denied
运行容器提示权限问题 docker run -v $PWD/myapp:/usr/src/myapp -w /usr/src/myapp python:3.5 python helloworld. ...
- Python IOError: [Errno 13] Permission denied:
一般是代码写错了,比如我遇到的问题就是由于 os.listdir() 传参传错导致的. 本应该传入字符串路径名,但传入了一个文件对象(object)
- ROS报错:IOError:[Errno 13]permission denied: /home/neousys/.ros/roscore-11311.pid"
在安装ROS后启动ROS,输入:roscore 时报错: 这个问题是由于该路径下ros文件权限造成的. 输入以下命令修改权限: sudo chmod -R ~/.ros/ 修改完成后再次输入rosco ...
- FLask上传文件
目录 Flask上传文件 改进上传 上传进度条 一个更简便的方案 Flask上传文件 文件上传的基本原理实际上很简单,基 本上是: 一个带有 enctype=multipart/form-data 的 ...
- flask上传文件到指定路径
flask上传文件到指定路径 项目结构如下: 首先是:视图函数uload_file.py,代码如下: #!/usr/bin/env python # -*- coding: utf-8 -*- fro ...
- 在apache环境中使用 python stock 请求遇到error: [Errno 13] Permission denied
一个python 项目运行在linux 环境下,使用apache做为web容器. 调用urllib2.urlopen(your url) 或者 xmlrpclib.ServerProxy()请求某个服 ...
- ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/itsdangerous' Consider using the `--user` option or check the permissions
近期练习flask写个blog, 安装flask扩展时 pip install Flask-WTF 报ERROR: Could not install packages due to an Envir ...
- Python UDP broadcast PermissionError: [Errno 13] Permission denied
/********************************************************************** * Python UDP broadcast Permi ...
- mac下载模块时报错OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/chardet'
原文地址:https://www.cnblogs.com/liangyan-1989/p/8143129.html 安装完pip后,使用pip install selenium报以下错 OSError ...
随机推荐
- Java各种工具下载
http://yunpan.cn/cyUzqFTu8pEER 提取码 355c myeclipse2013 http://yunpan.cn/cyUzPi7nC8Z9S 提取码 fc4b my ...
- bzoj1061--线性规划
线性规划裸题... 根据题目很容易可以得到线性规划方程(以样例为例): Min(2*x1+5*x2+2*x3) x1+ 0+ 0>=2 x1+x2+ 0>=3 0+x2+x3>=4 ...
- region URL请求数据
#region URL请求数据 /// <summary> /// HTTP POST方式请求数据 /// </summary> /// <param name=&quo ...
- 怎么写cookie
html结构 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...
- Robot Framework和Selenium 2 Grid集成指南
1. 环境搭建 A. 所需软件 1. Selenium2Lib 1.0.1 这个特性需要用到Selenium2Lib的最新版本1.0.1,但是这个版本还有一些iframe支持和IE支持的问题需要修改, ...
- 设置tableView的分割线填满cell的方式总结
方式一:cell的底部添加一个UIView 1.在tableViewController的viewDidLoad中取消系统的分割线 // 取消系统的分割线 self.tableView.separat ...
- C语言 动态创建二维数组
/*C语言 如何动态创建二维数组 转化为一维数组申请数组,创建和释放都比较简单 */ #include <stdlib.h> #include <stdio.h> #inclu ...
- C++待解
//[要求]按以下描述和要求建立一个含有对象成员的类TeleBook,用类Record定义的数组是TeleBook的数据成员. // 写出所有定义成员函数的代码.执行主函数对其测试. Record私有 ...
- OC中extern,static,const的用法
1.const的作用: const仅仅用来修饰右边的变量(基本数据变量p,指针变量*p). 例如 NSString *const SIAlertViewWillDismissNotification; ...
- 浅谈sql优化
问题的发现: 菜鸟D在工作的时候发现项目的sql语句很怪,例如 : select a.L_ZTBH, a.D_RQ, a.VC_BKDM, (select t.vc_name from tb ...