如何使用servlet在服务器上创建文件夹? [英] how to create folder on server using servlet?

查看:130
本文介绍了如何使用servlet在服务器上创建文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要帮助

我正在处理项目(网站).用户可以上传和下载文件.
对于上传是使服务器(glassfish)中上传的文件和数据库中存储的文件的一些信息(表项目[id autoincrement,文件名])有关.我的问题是,我希望在何时上传文件.在服务器上创建一个文件夹,以autoincrement id作为名称. (对于每个上载的文件,必须在服务器上为其创建一个文件夹)




在此先感谢

Hi
I need help

im working on project(website) .the user can upload and download files .
for upload am making the files uploaded in server(glassfish) and some info about file stored in database(table projects[id autoincrement,file name]) .My question is I want when the file uploaded .a folder will be created on server that takes the autoincrement id as a name . (for each file uploaded must has a folder created for it on server)




Thanks in advance

推荐答案



尝试按照以下步骤创建目录
Hi,

try following to create a directory
new File(request.getRealPath("users") + "/me@this.com").mkdir();


祝你好运
快乐的编码:)


Best Luck
happy Coding:)


这篇关于如何使用servlet在服务器上创建文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆