如何在bottlepy中获取文件地址? 我试了一下,但它返回了%s.shp
@get('/upload')
def upload_form():
return '''
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" name="filer" /><br />
<input type="submit" />
</form>
'''
@post('/upload')
def upload_submit():
file_csv = request.get("filer") # I want to get file address (string)
map = inflation_map.InflationMap(file_csv)
map.draw_image()
return file_csv
答案 0 :(得分:1)
当你这样做时:
request.get("filer")
您将获得该文件的名称。您需要通过指定路径save
将其放到文件系统上。
此处记录:http://bottlepy.org/docs/dev/tutorial.html#file-uploads