Help required with downloading files from inside WEB-INF folder

I am working on a web application and I have an upload script which uploads different files to a foler called 'uploads' . To stop users from accessing the folder content I have put it in the /WEB-INF/.
In my JSP file, I used to link to the uploaded files like this before for users to download them :
if(filesListIterator.hasNext()
files = (FilesBean)filesListIterator.next();
<tr><td><a target="_new" href="<%=files.getFileName()%>">"<%=files.getFileName()%></a></td></tr>
}I need to know how to alter the above link to make it access/download files from the /WEB-INF/uploads/ while still restricting direct access to the files.
Thanks
Message was edited by:
topiwal

Anything under WEB-INF is not directly accessible via the browser/ client. You could try defining the JSP/ Servlet inside web.xml deployment descriptor and see if you can access the file from there.
I think a better way to accomplish this would be to keep the file outside WEB-INF , and use other techniques to protect the folder that contains the file - for example password-protection, or defining a .htaccess file and serving a 403 Forbidden error.

Similar Messages

  • Download file from the web

    Hey,
    I'm struggling to download files from the web.
    The first approach I though of was simply opening the url in Safari, but it would just open the file, not download it.
    Then there is an application called "URL Access Scripting", but I can't figure out how it works.
    That might sound stupid, since it has only a download and an upload command, but they do not work.
    The download function asks for a file specification, what the #$^& is that?
    I tried supplying a file, but to no avail.
    For obvious reasons I can't make an alias of a not yet existing file, so what do I put in there?
    It seems file specification is a deprecated format.
    My last resort was running curl in a shell script, which works, but that feels hackish.
    Is there any good way to do this?

    Hi pepsel,
    Let's take an example. Suppose that you want to download “UltiCalc Mac 2.5” (freeware) from [this Web page|http://www.apple.com/downloads/macosx/games/utilities/ulticalcmac.html]. You can proceed as follows:
    --BEGINNING OF SCRIPT
    set theURL to "http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=23023&cat=25&platf orm=osx&method=sa/ulticalc_mac.zip"
    set theFile to "/Users/pierre/Desktop/My_download.zip" -- same extension as the file to download
    tell application "URL Access Scripting" to download theURL to theFile
    --END OF SCRIPT
    Of course, you should replace “pierre” with the name of your own home folder.
    Hope it can help.
    Message was edited by: Pierre L.

  • How to access the file in the WEB-INF Folder

    hi..
    i want to access a xml file, using servlet, which is placed under WEB-INF folder.
    Please tell me how can i access the file.
    I am using WSAD to develop the application
    Thanx in advance.

    I haven't tried accessing an XML file that is placed in WEB-INF folder.
    Files under WEB-INF are usually protected from client/browser access, but a Servlet may be able to access it (not sure though).
    What problems are you facing when you try to access an XML file in the WEB-INF folder?
    If you can't access it from the WEB-INF folder , place it in any folder except the WEB-INF folder.
    Also, if you want to protect the XML file then you could password protect it or deny access to it via .htaccess file, or simply return a 403 forbidden header.

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

  • Crystal Report Images Not Showing - JSP inside /WEB-INF folder

    Hi Experts,
    I am using Crystal report for Eclipse and also using Struts2 and tiles framework combination.
    The problem is when viewing the report all I've got is red X on all images and the graph image also not showing. This is when I use tiles and my jsp is inside the web-inf folder.
    This is my struts link: href="s:url value='/report/reportOpen.action?report=1'
    I've checked that the path to the viewer generated HTML is not correct. see code below.
    src="../../../crystalreportviewers/js/crviewerinclude.js"
    But when I test to access a simple jsp viewer that resides on the web root folder, this works fine but of course this is not what I want to have. I need to have my banner and menus on top of the report page (using tiles)
    This is my jsp link: href="s:url value='/ReportViewer.jsp?report=1'
    Viewer generated HTML below.
    src="crystalreportviewers/js/crviewerinclude.js"
    This might be a common problem and that you can share to me your solution.
    Note: I removed the script tags because I can't submit this entry.
    Thank you  in advance,
    Regards,
    Rulix Batistil
    Crystal Report Images Not Showing - JSP inside /WEB-INF folder

    Hi Saravana,
    After a few experimentation from your idea i was able to figure out the problem and now it is working.
    I don't have to copy the folder to where my jsp resides but still maintains it in the root location:  web/crystalreportviewers
    The changes should always be in web.xml.
    1st: change the crystal_image_uri value to ../crystalreportviewers
    2nd: change crystal_image_use_relative value to "web"
    Change to "web" instead of webapp because that is what I named my web root folder.
    <context-param>
              <param-name>crystal_image_uri</param-name>
              <param-value>../crystalreportviewers</param-value>
         </context-param>
         <context-param>
              <param-name>crystal_image_use_relative</param-name>
              <param-value>web</param-value>
         </context-param>
    Thank you. You showed me the way on how to solve the 3 day problem.
    BTW, my next problem is when clicking on any buttons prev/next/print/export, I got this error HTTP Status 404.
    Well, at least for now I can view my initial report.  I just need to figure out the next issue and with the help of the great people here in the forum.
    Thanks a lot.
    Regards,
    Rulix
    Edited by: Rulix Batistil on Nov 26, 2008 7:27 AM

  • Problems with downloading file from database!

    I have a table with my files:
    NAME     VARCHAR2(256)
    LAST_UPDATED     DATE
    MIME_TYPE      VARCHAR2(128)
    DOC_SIZE     NUMBER
    DAD_CHARSET     VARCHAR2(128)
    CONTENT_TYPE     VARCHAR2(128)
    CONTENT     LONG RAW
    BLOB_CONTENT      BLOB
    ID     NUMBER
    I have a procedure which download file for it's ID:
    procedure DownloadFile(id number)
    is
    v_mime VARCHAR2 (48);
    v_length NUMBER;
    v_file_name VARCHAR2 (2000);
    lob_loc BLOB;
    i integer;
    BEGIN
    i:=id;
    SELECT d.mime_type, d.blob_content, d.NAME, DBMS_LOB.getlength(d.blob_content)
    INTO v_mime, lob_loc, v_file_name, v_length
    FROM documents d, mydocs m
    WHERE d.id=m.doc_id
    and m.id=i;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
    -- set the size so the browser knows how much to download
    HTP.p ('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    HTP.p ( 'Content-Disposition: attachment; filename="'
    || REPLACE (REPLACE (SUBSTR (v_file_name,
    INSTR (v_file_name, '/') + 1
    CHR (10),
    NULL
    CHR (13),
    NULL
    || '"'
    -- close the headers
    OWA_UTIL.http_header_close;
    -- download the BLOB
    WPG_DOCLOAD.download_file(lob_loc);
    end;
    And when I press Download button, it open the file content in browser.
    But I need save dialog, for saving the file in the clien machine.
    How to solve this problem?
    Regards,
    Kostya!
    Message was edited by:
    Kostya

    How downloaded objects/document are treated in browser is purely "browser defined behavior". Sometime someone said that or these kind of files (recognized by miome contenet - alias file extension) default behavior will be "show inline" or show in browser. This is esspecially true for Adobe 7.x and IE 6.x and Firefox 2.x....
    For a test of my thoughts, install new browser (let say Opera or Mozila) and try to download LOB(doc). I'm sure that "Save As" dialog will show!
    Hope this helps!

  • Problem with downloading file from FTP server

    Hello all
    I have uploaded a file from an application i developed and i want to download this file from another application. The code is
    public static void FTPcon() throws FtpException{
       String hostname = "my.ftp.server";
       String username = "myusername";
       String password = "mypass";
       Ftp ftp = new Ftp(hostname,username,password);
       ftp.setHostname(hostname);
            ftp.setUsername(username);
            ftp.setPassword(password);
            ftp.connect();
            ftp.setBinary();
            ftp.download("file.dat");
            ftp.disconnect();
    }The error i receive is java.io.FileNotFoundException: public.dat (The system cannot find the file specified) but the file is on the server.
    Thanks in advance for any help

    Cotton thank you for your reply
    Any other sugestions please?The server disagrees. So...
    - the file does not existThe file exists.I checked it with an FTP client program.
    - the file has a different nameThe file name is correct
    - you are connected to the wrong serverI am connecting to the correct server
    - you are in the wrong ftp directoryThe file is placed in the home directory
    - the ftp library you are using is broken (less
    likely)I am using the library from jscape.I dont think is broken because i can upload the file from the first application.
    >
    FTP isn't somehow broken in Java. I use it all the
    time. The problem is something listed above. I would
    check all of the first four if I were you because
    that's most likely where the problem is.Message was edited by:
    flightcaptain

  • Cannot Download Files from Certain Web Site

    There is a website I must use for work quite often. Whenever I try to download or open a file from the site, I get the following error:
    Safari can't open the file.
    Safari can't open the file ""2010 Pennsylvania Release Notes.pdf" because ""2010 Pennsylvania Release Notes.pdf" has moved since you downloaded it.
    I am using a Windows XP machine and these files work fine with any other browser. I really want to make Safari my default browser, but it is out of the question as long as this continues to happen with Safari alone.

    I just noticed, when I try downloading a PDF file using Safari from this website, it puts a " in front of the file name. It does not do this with any other browser. I think this may be what is causing the issue. Does anyone know how to fix this? Thanks!!

  • Problems with downloading files from the internet?

    I have Mozilla Firefox and Safari on my macbook. For some reason it will not let me download things from the internet. Whenever i keep a download link, the page never loads....can anyone put some insight into my problem?
    Justin Evans

    Since a few hours, I have the same problem like you. I uninstalled Firefox, because I thought it was a problem with it, but then i started Safari to redownload Firefox and guess what happened.. nothing. I can't download anything. don't know why. does anyone know whats wrong??

  • I am having problems downloading files from the web. After a number of files are downloaded, the system become sluggish, and then hangs. I traced the problem to the download history file: downloads.sqlite.

    After downloading a number of 1.0 MB files, the system became very sluggish, and I started to get lots of (Not Responding) messages when trying to download or just use Firefox for browsing. Using Performance Monitor, I observed that the Firefox executable was growing larger and larger - up to as large as 1.2 GB on a system with 2.0 GB memory. Page faults were off the chart.
    Looking for a similar problem, I found one that discussed the downloads.sqlite file becoming corrupted. I first noticed that this file was over 600 MB in size, so I deleted it. I then downloaded additional files, and observed that the new downloads.sqlite file would increase in size by about 150% of the size of each file that was downloaded. Once it would get up to 500 MB in size, the system started slowing down again.
    I don't know the purpose of this file, but it appears that it keeps a full copy of every file downloaded, which may be the function of a download history file, but it does not seem correct that the file should grow in size without limit, and thus impact the system.
    I would also appear that the Firefox executable is trying to read the entire contents of this file each time a new file is downloaded, which does not seem right.
    Temporary fix is to periodically delete the downloads.sqlite file when it gets too large and starts impacting performance.. Apparently it is smart enough to open a new file if the old one is not found. I am not sure what the correct behavior for this file should be. Apparently is does not re-initialize when a new Firefox session is initiated.
    Please feel free to contact me if more information is desired. I'm not sure what details you might need to troubleshoot this type of problem.

    Hi Katy, and a warm welcome to the forums!
    What is the exact name of the file?
    Is it aim.bin?
    Which requires either Stuffit Expander, or the Unarchiver to deflate.
    http://www.apple.com/downloads/macosx/systemdiskutilities/theunarchiver.html

  • Help Please with moving files from an External HD to a New Hard Drive

    OK My Powermac MDD's Hard Drive Needs Replacing, but before I replace it I was told to buy Super Duper software and backup my hard drive and the applications onto an external Hard Drive. I am going to go and buy another external Hard Drive tomorrow and do this, but I have a few questions...
    What do I need to do to do this successfully? Please explain in the simplest of terms.
    Here's the steps as far as I understand. Please correct where necessary.
    1. Buy an external HD like an LaCie for example.
    2. Attach the LaCie external Hard Drive to my mac. *What Do I need to do to set it up to use with Super Duper? Please explain this in detail if possible as it is really confusing me how to set up my external LaCie Hard Drive so I can move my Files to it using Super Duper and then put the files back onto a new Hard Drive!*
    I've read I need to be able to "boot from the External Hard Drive" after I copy my files there using Super Duper. What do they mean by booting from the hard drive?
    Do I need to "format" my new LaCie Hard Drive?
    What do I use to format the LaCie Hard Drive? I think the last time I didn't have to do anything, when I used my external Hard Drive for storage only, but do I have to do something special now that I want to copy my whole hard Drive from the LaCe external back ont a "New" G4 Hard Drive?
    3. Buy or Download "Super Duper" software to copy all of the contents of my Hard Drive to the LaCie external Hard Drive. Does anyone know if the demo will do this or do I need the advanced features?

    Thanks Japamac, Wel this is a very lengthy reply so forgive me but I feel like I am getting close to understanding this so please bear with me. Thanks! Well I see I have 2 options that both sound viable. I ran disc utility and under S.M.A.R.T. it said: Failure. The only application I can't open is Safari and the drive is still turning properly and semi-reliable though, so I may be alright to clone still. There is stil the issue of errors though. If there are errors I agree with you I don't want to copy themm over to a new drive but can I not run disc utility after I copy verything over to the new drive?
    My reason for wanting to use Super Duper is that I have about 23 applications that all have different serial no's etc. and to reinstall all of these would take a considerable amount of time, so that's why I was wanting to use SD, but if "Migrate Assistant" will copy over applications like Photoshop, Mail and other applications then I think that might be a lot better because my install would be a lot cleaner and I could only install what I needed. What do you think?
    It looks like "Migration Assistant" only comes with Tiger. This throws a wrench into things. What would you do? Would you buy Tiger or just use Super Duper etc. Can I install Tiger onto my external Hard Drive only and then use "Migration Assistant" to transfer files over even if my Hard Drive only uses Panther? Sorry for all the questions but I see there are a few ways to do this and I want to use the method that will work best. : )
    So if i use Migrate Assistant do I need to copy over my system preferences too? I think if I copy my applications they will create new preferences when launched won't they. Also would all of my "Mail" information be copied over using "Migrate Assistant"
    Method #1 (Using Super Duper)
    1) Install the external HD and format it using "Disc Utility"
    2) Run "Super Duper" and clone my hard Drive to the external Drive.
    3) Disconnect the external Hard Drive
    4) Disconnect the computer and install the new hard drive
    5) Reconnect the external Hard Drive and Run "Super Duper" and transfer the information back to the new hard drive.
    6) Run Disc Utility and fix any errors.
    7) "Erase" the contents from the external Hard Drive
    8) Done!
    Method #2 (Using Migrate Assistant)
    1) Use the mac G4 discs and select the "External Hard Drive" and Install the OS from the install disc directly to the "External Hard Drive".
    2) Then use my Panther discs and select the "External Hard Drive" and install Panther to the "External Hard Drive".
    3) Go into "Preferences" and select "External Hard Drive" as my "Startup Disc" so it will "boot" to the "External Hard Drive".
    4) Use "Migrate Assistant" to migrate or transfer only software applications (Photoshop. Mail, Address Book etc.) from the "old" hard drive to the "External Hard Drive".
    5) Disconnect the external Hard Drive
    6) Disconnect the computer and install the new hard drive
    7) Reconnect the external Hard Drive and Run "Super Duper" and transfer the information back to the new hard drive.
    8) no need to run Disc utility as it's like a clean install.
    9) "Erase" the contents from the external Hard Drive
    10) Done!
    Please tell me if I have missed a step or if a step is incorrect in the above 2 methods.
    Q) I can't find my G4 install discs, can I use my Panther install discs instead?
    Q) Does "Migrate Assistant" come with Panther or does it only come with the mac install discs?
    Q) Will "Migrate Assistant" copy over my "Mail" application and it's setting or do I need to totally reinstall that?
    Q) How long does "Migrate Assistant" take to transfer vs.. Super Duper?

  • PLEASE HELP-problem with downloaded files!

    I have downloaded some games and stuff from the internet to my new iMac(Leopard10.5.1). I open the files, copy to applications, or install from the folder-and that should be it, right?? Unfortunately, this is not so! I have to go through this same process every time I want to use one of my downloads. I have to re-enter serial numbers and all that stuff EVERY TIME!!! Why is this happening? I don't understand...

    No, it's the computer. The files are fine, the computer just doesn't seem to keep the info once I install. Never had this issue with any of my previous macs.

  • Help required with text file handling in GPIB

    Hi attached is my vi for GPIB communication with Aginelt Network Analyzer in Labview 8.
    I'm saving the data of network analyser into text file(appending all the data). I wish to make some changes into it. As can be seen there is a input which asks for number of points/segments. Supposed I give that input as 201 points(it can be 401,801,1601,51,etc.) than after every 201 points data should get appended into a new coloumn and not into 202 row. Seperate coloumn should start for the whole set of 201 points, where as currently what is happening is all the data is getting appended one below the other.
    Can anyone help around,
    Regards
    Attachments:
    finaltemp.vi ‏52 KB

    Here...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    finaltemp(80).vi ‏52 KB

  • I cannot download files from my Google Drive folder. Every time I try I get the message "The page isn't redirecting properly . . ."

    This is a new install of Firefox. Everything works OK in Chrome or MSIE. I deleted google cookies and drive.google cookies, but no success.
    I have followed this advice:
    "You can set the Boolean pref network.cookie.thirdparty.sessionOnly to true on the about:config page to have third-party cookies act as session cookies." No success.
    I checked this:
    network.http.sendrefererheader - it is set to 2 (default)

    ''modrab [[#question-1050089|said]]''
    <blockquote>
    This is a new install of Firefox. Everything works OK in Chrome or MSIE. I deleted google cookies and drive.google cookies, but no success.
    I have followed this advice:
    "You can set the Boolean pref network.cookie.thirdparty.sessionOnly to true on the about:config page to have third-party cookies act as session cookies." No success.
    I checked this:
    network.http.sendrefererheader - it is set to 2 (default)
    </blockquote>
    Deleting the cookies.sqlite file did the trick, although I have no idea why - or why it wold be corrupted, since it was a fresh install of Firefox.
    Thank you for your quick response.

  • Downloading file from application server to presentation server

    Hi,
          We have a requirment to download file from application server to presentation server.  The problem is while down loading, some of the filds showing some junk values. Instead of that junk values we have some Russian texts there.  These Russian texts only coming as junk all other data is correct.  The file in the appplication server is in .dbf format. We are downloading using WS_DOWNLOAD. file type is BIN and code page we didn't specified.
    Thanks in Advance
    Jijeesh.P.G
    Message was edited by: Jijeesh.P.G
            Jijeesh P G

    hi jijeesh,
       Welcome to SDN.
    u can use to download file from application server to presentation server using the t/c CG3Y. in that it will ask the source file path and the target file path.
    if u want to find the source file path in the application server, u can use the transaction AL11 to find that one.
    Regards....
    Arun.
    Reward points if useful.

Maybe you are looking for

  • 24" IMAC Display Too Bright

    I am still doing DD on changing from WinTel to Apple. I have viewed both the 20 inch and 24 inch models at a local reseller. I have heard of several complaints that the 24" is too bright. Is there any validity to this complaint? Can the Brightness be

  • Editor and doc lookup

    I downloaded Java 2 beta 1.4.0 and it compiled an ran a simple program. Is there a Java sensitive editor and documentation retrieval by class name that comes with this system. I am lost on this subject. How does one do programming? I need an editor a

  • HT5858 I upgraded my ipad.  Now it requires a password to open, I have tried every password I know. Now it is disabled

    I upgraded my ipad yesterday. Now it requires a password.  I tried my password, then every password I use.  It is now disabled.  It says go to itunes to reset. I reset password this morning, still nothing.  Now do I open this ipAD.

  • Static Routing - WRT54

    I am using the Advanced Routing section. When I initially enter the IP addresses and click Save Settings the assignments work properly. When I power down my router and repower it, the assignments no longer work. I must SAVE SETTINGS each time after r

  • Dynamic Refresh Region with APEX 4.0

    Greetings! With APEX 4.2, when you want to refresh a region that depends on an page-item-value, there are different ways to submit that item with the dynamic action ("Page Item zu Submit"). But this is not imcorperated in APEX 4.0 yet. Is there a way