How to programmatically mkdir and move uplaoded files? [message #1255952] |
Tue, 25 February 2014 00:59 |
David Lee Messages: 78 Registered: May 2013 |
Member |
|
|
I migrated my RAP app from Windows to the Ubuntu 13.10 Server, everything is fine except the file upload/download functionality, I need to programmatically generate directories and put uploaded file into its corresponding directory, as well as to move/rename/read/write the uploaded files.
In Windows it's OK, in Ubuntu Server, it failed, I think that's probably because of Ubuntu's file/directory privilege management at first, so I referred to the privilege of directory /var/lib/tomcat7/webapps, as it's the location to put the uploaded .war files via Tomcat webpage of deployment, I did the following first:
( where MYDIR below is the directory what I hand generate first)
cd /var/lib/tomcat7
sudo mkdir MYDIR
sudo chown R 107:112 MYDIR
sudo chmod R 775 MYDIR
And then, in RAP app, programmatically generate directories and put uploaded file into MYDIR, such as
File myImgDir = new File( "/var/lib/tomcat7/MYDIR/img" );
if (!myImgDir.exists())
myImgDir.mkdir();
but it still fails to generate expected directory /var/lib/tomcat7/MYDIR/img ! I cannot figure it out!!!
Please help me solve this problem, thank you!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03016 seconds