Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to programmatically mkdir and move uplaoded files?(used for web upload/download files)
How to programmatically mkdir and move uplaoded files? [message #1255952] Tue, 25 February 2014 00:59 Go to next message
David Lee is currently offline David LeeFriend
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!
Re: How to programmatically mkdir and move uplaoded files? [message #1256381 is a reply to message #1255952] Tue, 25 February 2014 11:16 Go to previous message
David Lee is currently offline David LeeFriend
Messages: 78
Registered: May 2013
Member
Well! My approach is correct! After a Tomcat restart, everything was solved as expected! Because the mkdir statement is stated in Activator.java, and which excutes just once and in the very beginning when Tomcat starts!

If you deploy your RAP app on Ubuntu, and provide upload/download functionality, you can refer to my previous post in this thread, the points are to

sudo chown R 107:112 yourUploadDir
sudo chmod R 775 yourUploadDir

Where 107 is Ubuntu user Tomcat's uid!
Hope this information is helpful!
Previous Topic:Chrome display issue
Next Topic:SWT Image location in ResourceMananget
Goto Forum:
  


Current Time: Fri Apr 26 19:20:47 GMT 2024

Powered by FUDForum. Page generated in 0.03016 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top