cflocation to a file located 'above' the httpdocs folder

hi guys, i got a tricky one here...
users can upload word documents (.doc) to my server (using
cffile).
the idea is to only allow certain users access to those
documents, therefore i am thinking that storing them 'above' the
httpdocs folder is probably a wise move (that way no one can get to
them using httpaccess, right?)
i can write the files to my desired location using <cffile
action="copy"... just fine
the problem arrises in giving (the authorised) users access
to those documents.
i want them to be able to download those documents via their
browser and had planned to do so using <cflocation
url="#absoloute-path-to-required-document-on-server.doc#" >
it seems this works fine if the file is within the httpdocs
folder, but not if it's above it..
does anyone have any suggestions?
i'd be very grateful of any input whatsoever (if you think
i'm tackling this the wrong way for example, i won't be offended :)
thanks very much indeed.
kind regards
Nick

> P.S. If you want clean downloads using the
<cfcontent...> method there
are some headers you would probably want to set as well to
inform the
browser the proper file name and extension of the download.
This is
well discussed and blogged all over the internet and full
examples are
plentiful.
Ian, do you mean like the <cfheader...> tag I posted in
my original reply?
<cfheader name="Content-Disposition" value="inline;
filename=document.doc">
The full code I use to push files to users is as follows.
Save this as getFile.cfm, update the fileshareroot variable, update
the code that checks that the user has valid access rights, and
access by sending a user the url:
http://myserver.com/getFile.cfm?filename=myFileToGet.ext
<cfparam name="filename">
<cfset fileshareroot="/my/fileshare/root">
<!--- verify user can access this file. --->
<cfset validAccess = false>
<cfif userCanAccess> <!--- must be customized
--->
<cfset validAccess = true>
</cfif>
<cfif not validAccess>
You are not authorized to view this document.
<cfabort>
</cfif>
<!--- verify document exists --->
<cfif not FileExists("#FileshareRoot#/#filename#")>
The document you requested doesn't exist.
<cfabort>
</cfif>
<!---
// getContentTypeFor() uses mime types from
// JAVA_HOME/lib/content-types.properties or
// JAVA_HOME/jre/lib/content-types.properties
--->
<cfset URLConnection =
CreateObject("Java","java.net.URLConnection")>
<cfset myMimeType =
URLConnection.getFileNameMap().getContentTypeFor(filename)>
<!--- if the file extension isn't found in
JAVA_HOME/jre/lib/content-types.properties, then myMimeType isn't
defined. Set it to text/plain --->
<cfif not isDefined("myMimeType")><cfset myMimeType
= "text/plain"></cfif>
<cfheader name="Content-Disposition" value='inline;
filename="#filename#"'>
<cfcontent type="#myMimeType#" deletefile="No"
file="#FileshareRoot#/#filename#">

Similar Messages

  • When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder". How can i fix this?

    When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder. How can i fix this problem?

    Anyone can help to advice how to solve this issue ?

  • I just upgraded my mac book to 10.6.8 and downloaded the new version of itunes. When I try to open it and error message appears saying, "The iTunes Library file cannot be found or created. The default location for this file is in the "iTunes" folder.

    I just upgraded my mac book to 10.6.8 and downloaded the new version of itunes. When I try to open it and error message appears saying, "The iTunes Library file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder."
    I have tried a few things but iTunes closes right after i click okay. Anyone know anything?

    Look in your Home > Music folder.  There should be an iTunes folder there and it should have a number of files and folders including one called library.itl  You want to guide iTunes to that file.  If you don't see that file or folder then in your next post you will have to be very specific as to what you do see or how you have your iTunes set up because that's where it should be according to default settings.

  • I need help every time my iTunes library updates i get this error messege: The iTunes.itl file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder. but the file should be there.

    Every time I have to upgrade iTunes it gives me this messege:'The default location for this file is in the "iTunes" folder in the "Music" folder.' the file should be there but I don't understand why it does this every time Apple upgrades the Itunes library. Its on the computer somewhere but it only affects this login on my computer (meaning on this Windows Account). Why does my iTunes do this? Then I have to spend hours placing all my libraries back together and all my music back into the library. Which usually takes me a few days to sort all out. What is wrong with my iTunes? The iTunes folder is a folder in my Music folder where I store the iTunes music/files/libraries at on my computer so I can have all of the iTunes files in one place on my computer.

    I have a Windows 7 operating system my computer runs from.

  • Itunes library.itl file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder

    itunes library.itl file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder, I keep getting this message everytime I try to install Itunes after having to remove windows 8.1 and go back to windows 8.  I have uninstalled and reinstalled and it keeps telling me the same thing. What do I do?

    Hi Renee31,
    If you are having issues with the library.itl file in iTunes, you may find the following articles helpful:
    iTunes: What are the iTunes library files?
    http://support.apple.com/kb/ht1660
    Apple Support: Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    http://support.apple.com/kb/HT1923
    Regards,
    - Brenden

  • TS1717 iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder."  How can I fixt this?

    iTunes will not open.  I get a message that says, "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the music folder".  How can I fix this?

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • I am trying to open iTunes on my Windows 7 PC and am getting the following message...the itunes library can not be found or created.  The default location for this file is in the "iTunes" folder in the "Music" folder.  Any ideas?

    I am trying to open iTunes on my Windows 7 PC and am getting the following message...the itunes library can not be found or created.  The default location for this file is in the "iTunes" folder in the "Music" folder.  Any ideas?

    Let's try this first. Hold down the Shift key while you try to launch iTunes. You should eventually see the following dialog:
    Click "Choose library". Browse to inside the following location (depending on what operating system you're running):
    Operating System
    Default location of iTunes library
    Microsoft Windows XP
    \Documents and Settings\[your username]\My Documents\My Music\iTunes\
    Microsoft Windows Vista
    \Users\[your username]\Music\iTunes\
    Microsoft Windows 7
    \Users\[your username]\My Music\iTunes\
    ... and open the iTunes library you find in there.

  • I keep getting the following message The iTunes library cannot be found or created. The default location for this file is in the iTunes folder in the music folder.

    I keep getting the following message The iTunes library cannot be found or created. The default location for this file is in the iTunes folder in the music folder. All of my playlists have disappeared and I am trying to recover them however I now can't even open iTunes!

    Hi crazymaiden,
    I have two articles for you here that should be able to help you troubleshoot this issue with your ability to launch iTunes:
    Troubleshooting iTunes installation on Mac OS X
    http://support.apple.com/kb/HT2311
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/HT1451
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • TS3494 my iTunes has stopped working on my mac book pro 13" when i try oping it it saysThe iTunes Library file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder.

    my iTunes has stopped working on my mac book pro 13" when i try oping it it saysThe iTunes Library file cannot be found or created. The default location for this file is in the “iTunes” folder in the “Music” folder. i dont know what to do i need my itunes back

    Hi pgarard1,
    If you are having issues with launching iTunes after an update, you may want to take a look at the troubleshooting in the following article:
    iTunes for Windows: Doesn't open after upgrading in Windows Vista or Windows 7
    http://support.apple.com/kb/TS2363
    Regards,
    - Brenden

  • Error while accessing a file located in the server from JSP

              Hi
              I am having problem while accessing the file located in the server from a JSP
              page. I am not getting the RealPath from a JSP page using getRealPath(request.getServletpath()).
              The same code is working if the jsp placd under defaultwebApp directory and not
              working if i create a war and deploy the same.
              I am using weblogic server 7.0 trail version.I am setting the context path also.
              Can any help me in this regard.
              Thank And Regards
              Anand Mohan
              

              Hi
              Thank you.Is there a way to read a file which is existing in the war file.
              Regards
              Anand Mohan
              "Wenjin Zhang" <[email protected]> wrote:
              >
              >In Weblogic, if your files are archived in a WAR, you cannot get an entry
              >as individual
              >file since it is only bytes in a large archive file. So getRealPath will
              >give
              >you null result. If you only want the path, try to use other getXXXPath,
              >getURL,
              >or getURI method. If you want to read the content, use getResource.
              >
              >
              >"Anand" <[email protected]> wrote:
              >>
              >>Hi
              >>I am having problem while accessing the file located in the server from
              >>a JSP
              >>page. I am not getting the RealPath from a JSP page using getRealPath(request.getServletpath()).
              >>
              >>The same code is working if the jsp placd under defaultwebApp directory
              >>and not
              >>working if i create a war and deploy the same.
              >>
              >>I am using weblogic server 7.0 trail version.I am setting the context
              >>path also.
              >>
              >>Can any help me in this regard.
              >>
              >>Thank And Regards
              >>
              >>Anand Mohan
              >
              

  • Cannot shrink log file 2 because the logical log file located at the end of the file is in use ?

    HI,
    I am getting this error frequently.. any recomendations :
    Executed as user: DB0\sqlservices. Processing database: dbin [SQLSTATE 01000] (Message 0) 
    Cannot shrink log file 2 (DB_log) because the logical log file located at the end of the file is in use. [SQLSTATE 01000] (Message 9008) 
    Processing database: DB_ [SQLSTATE 01000] (Message 0)  DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Message 2528) 
    Cannot shrink log file 2 (DB_log) because the logical log file located at the end of the file is in use. [SQLSTATE 01000] (Message 9008) 
    Processing database: DB [SQLSTATE 01000] (Message 0) 
    DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Message 2528) 
    Backup, file manipulation operations (such as ALTER DATABASE ADD FILE) and encryption changes on a database must be serialized. Reissue the statement after the current backup or file manipulation operation is completed. [SQLSTATE 42000] (Error 3023) 
    Processing database: DB_AC [SQLSTATE 01000] (Error 0)  
    [SQLSTATE 01000] (Error 0)  DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Error 2528). 
    The step failed.
    Please give any receomendations to avoid this error in future :
    Yangamuni Prasad M

     
    Hi Yangamuni,
    Are there any progress?
    Please have a look on the below threads with the similar issues as yours:
    http://www.sqlservercentral.com/Forums/Topic652579-146-1.aspx
    http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/ae4db890-c15e-44de-a2af-e85c04260331
    The solution is change the recovery mode to SIMPLE, shrink log files and then change to the FULL recovery mode.
    Thanks,
    Weilin Qiao
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.

  • Open file located in the HTMLResources with adobeDPS.dialogService.open()

    Is it possible to open file located in the HTMLResources with adobeDPS.dialogService.open()?
    Method adobeDPS.dialogService.open('http://www.google.com/') - works well, but it not support relative URLs
    I can make button in InDesign layout with url "HTMLResources/faq.html",
    but how to make HTML-button in web-overlay that opens file from HTMLResources in slideup webview?
    Thanks

    Hi, Why do you need to use HTMLResources?
    You can try use all HTML files (faq.html too) in web content.
    Do you want a lightbox effect, than your webcontent frame need to be the same size of page
    I believe that the results is quite similar.
    regards

  • I cant uninstall my itunes off my computer, i have followed instructions and i still have errors, including error 2330 and redundance cyclic. the only software i have left is itunes.exe and file es.lproj which is located in the ituneshelpresources folder

    I cant uninstall my itunes off my computer, i have followed instructions and i still have errors, including error 2330 and redundance cyclic. the only software i have left is itunes.exe and file es.lproj which is located in the ituneshelpresources folder. i recently installed a second hard drive and that let me uninstall everything. I just want to get itunes off my computer and reinstall itunes, i have deleted everything i can and i ran "chkdsk" this did nothing. I would have just updated the oild itunes to the newest version but it didnt ley me do that. installing/ uninstalling or deleting just lets me get half way and shows me these errors. Please help, thank you.
    JPHowarth

    the only software i have left is itunes.exe and file es.lproj which is located in the ituneshelpresources folder.
    If the chkdsk isn't fixing the damage, and those are the only iTunes that can't be deleted, try renaming the "iTunes" folder that they are contained in (in your Program files) to iTunesOLD.
    Now try another install. Does it go through without the 2330 this time?

  • HT1766 where is the Itunes backup file located in the computer ?

    where is the Itunes backup file located in the computer?

    Read here:
    http://support.apple.com/kb/ht4946

  • I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview

    I tried to rename a file, it gave me an error message (can't remember the number - 43??) and then the file disappeared from the original folder. When I do a search, the file comes up under the new name, but it does not show a path, and even though preview shows the contents, I can't open the document (Powerpoint) and I can't move the document. I tried "Copy" and paste but it doesn't work. I tried "Share" with Airdrop and iChat, but the file is inaccessible. When i try to rename the file, it says the filename is too long.
    When I try to open it, it says the alias is not good, and asks if I want to fix the alias. I'm afraid to do that and lose all access to this document.
    Right now, it feels like a ghost document - it is on the computer intact, but it is in an undisclosed location and inaccessible.
    Please help!!

    I was able to resolve this by repairing permissions, even though no permissions error was listed specifically for that file.
    I could also have recovered it through Time Machine, but I'm interested in knowing how not to have this happen again!
    I was afraid of rebooting and possibly losing track even of the ghost.
    I did not try EasyFind - I'll keep that in mind next time.
    Thanks for all the comments.

Maybe you are looking for