Skip to main content
nikos101
Inspiring
December 10, 2008
Question

how so you stop web users accessing .swf files directly

  • December 10, 2008
  • 4 replies
  • 802 views
In a CF server, how so you stop web users accessing .swf files directly eg:


www.mydomain.com/main.swf

Many Thanks
This topic has been closed for replies.

4 replies

BKBK
Community Expert
Community Expert
December 14, 2008
In a CF server, how so you stop web users accessing .swf files directly eg:
www.mydomain.com/main.swf


By storing them out of the web root. If they must be under the web root, then use authentication to control access.

Inspiring
December 12, 2008
How about setting the folder so there is no access to it.
Then create a link to the file on your site.
ShowFile.cfm?ID=#Some_ID#
This loads ShowFile.cfm:
<cfif fileExists('C:\inetpub\YourSite\SWFs\#url.Some_ID#.swf')>
<cfheader name="Content-Disposition" value="inline; filename=#Some_ID#.swf">
<cfcontent type="application/*" file="C:\inetpub\YourSite\SWFs\Some_ID#.swf" deletefile="no">
<cfelse>
Sorry the document you requested is no longer available.
</cfif>
It needs a little work for your site, and can be made dynamic so you can use it for other file types, but you get the idea.
nikos101
nikos101Author
Inspiring
December 10, 2008
What would the .htaccess file look like to allow only the index.cfm file to be seen?
Inspiring
December 10, 2008
Hi,

Through placing a .htaccess file in your swf directory you can display a login authentication window, through which you can protect users from accessing your swf's.

Contacting your hosting provider might be a good option here.
Inspiring
December 10, 2008
Hi,

i) Ask your hosting provider about the availability of the folder named "private" and place your files inside that, It can't accessible through web.

ii) Or else place a .htaccess file