Giving access to file from Tomcat to external user - apache

I have Tomcat setup with servlets. When the user request a file to download, then I send him the path to the file to download.
1-Currently the path is in C drive. Do you think I should move it to be somehwere under Tomcat?
2-How can I give the user access to the folder/file so he can download it?
3-Finally, if there are multiple files inside the folder. How can I ensure he can only see this file (i.e. if he manually changes the file name in the URL, he won't get the file with that modifed file name)
Thank you

One possibility:
Yes move them over to tomcat say under /myapp/resources/file_library
when the users requests for a particular file , build a temp user directory and
copy the file in there and send the link to him , as in
/myapp/user_xyz/requestedfile#1
Always maintain the temp location with only one file, i.e. when the user requests another
file, clear the temp user-specific area and put the next file in .
/myapp/user_xyz/requestedfile#2

Related

Apache server not able to download file having copy as file name

In a web application user has provision to upload a files to the server which can be downloaded and viewed in future. We have to maintain the file name same as that it was uploaded for future downloads.
When a user uploads a file name having copy as a file name like Copy_template.xls the Apache server throws 403 error, but if we rename the file by removing copy they are able to download. How to fix this?

Files Lost during move in cPanels File Manager

I had a task that required me to move files from a subdomain to the public_html directory on my cPanel. To move them I simply selected the files and directories I wanted from the subdomain, clicked move and entered the destination path.
Once the move process had completed, only some of the files and folders were in the new location (public_html). The files that didn't move to the new location no longer seem to exist.
Has anyone encountered this problem before and is there any way to recover the lost files (they aren't in the trash)?
Thanks in advance!
Have you tried to connect to your server with other FTP client like FileZilla or something similar to see if the files are still missing. It seems like UI glitch. cPanel represents only an user interface and is not able to delete the files.

Creating .htaccess files (Ubuntu Server 12.04 w/ Apache2)

Whenever I create an .htaccess file in a directory it disappears. I am running a VPS at Digital Ocean (I have full control over the server). So I can't see why my .htaccess files are automatically deleted upon creation. I even tried to make the file on my computer and just transfer it to the directory via FTP but as soon as it transfers, it disappears. I checked the log of the FTP transfer and the file transferred successfully. I can't figure this out.
Its because system files are hidden on apache servers... Either select the option to see hidden files if you're using a GUI or type the command "ls -a" if you're on terminal and you should see the files. Any file that starts with a dot is going to be hidden by default. Your .htaccess files fall within the same category.
If you want to be able to view the .htaccess file on the server, make sure you are logged in as the root user, or a user with root level permissions.
Then, navigate yourself to "/home/username/public_html(in my case)" And if you have a .htaccess file uploaded, it should be displayed there.

How to download files from a web folder in vb.net

I have a web folder e.g. "http://www.myhost.com/software/" if I open this address in IE it show me all files which this folder have.
I want to download all files but I don't want to hard-code name of files. I know I can get the files with webclient.DownloadFiles(#address,#filename). Is this possible to download all files or at least get the name of files from the web folder?
As a minimum you can download the same file IE displays (note that this file is provided by your web server -- there is not a standard) and parse the HTML for the files yourself, e.g. using webclient.DownloadFile("http://www.myhost.com/software/", #listfilename).
To access the files more "professionally", you'll need to see if the server also allows access via FTP or WebDAV because HTTP does not have a file "interface".

How to access the "app" folder via browser (localhost) in cakePHP?

I am using Apache server. Usually when I want to start a new website project, I created a new folder inside my server directory and inside that folder I would have 'index.html or index.php'. When I direct my localhost URL to that folder, it would open it and automatically display index.php.
Now I am trying something new with this CakePHP framework. I finished setting it up, and when I direct my localhost URL to folder 'cakephp-cakephp' (folder containing all the cakePHP files), it then shows me this message:
Release Notes for CakePHP 2.0.0-dev.
Your tmp directory is writable.
The FileEngine is being used for caching. To change the config edit APP/config/core.php
Your database configuration file is present.
I think the next step here is to start the development by saving all my files to "app" folder. But the message is not gone even when I deleted the default index.php files from inside the folder 'cakephp-cakephp'. It seems anyway, the index.php files do not actually generate the message.
Does anybody know what file generates that release notes message? I want to delete that file so that I wont get the message (which I believe is triggered by some default file like 'index.php') when I access folder 'cakephp-cakephp', and then it will show me the file directory inside that folder instead, and I can traverse file directory easily using my browser and access my app folder, in which I am planning to store my index.php file, and save all my development files..
You cannot delete the index.php files and you usually don't modify those files unless you need to do some special configuration. Adding the file app/views/pages/home.ctp gets rid of that message and becomes your default home page.
Also, as stated in the comments, you should really read the manual and try the tutorial.
http://book.cakephp.org