如何使用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:)