Check files exists

Checks to see if a file exists on your server.

Wait, does that file exist?

Wait, does that file exist?

Download

Overview

Convention over configuration. Sometimes it’s easier to just upload 500 files through FTP than to upload them individually item by item through your website’s backend. This plugin makes it easier to assume that product 343’s PDF manual is on your file server and can be downloaded without a broken link.

You can use this plugin to test for a file’s existence before providing a download link (or any other use you can think of.)


Download

Categories:
ExpressionEngine, Plugin

1. Requirements

ExpressionEngine 1.6.5+

2. Installation

Upload this file to your ExpressionEngine's plugins folder

3. About

Checks to see if a file exists at the location passed in. If the file does not exist nothing is output by this plugin. If a file does exist at the location being passed in, the source location is returned. 

4. Parameters

src: the source of the file (http://whatever.com/whatever.jpg) If this parameter is not found, this plugin will parse the content between the plugin tags (see example 2. below)

root_path: (optional) the server's  path to the root of the file (useful if your file is not available at a publicly accessible location; http://something )

wrap_left: (optional) HTML or text that will appear before the file name (if it exists)

wrap_right: (optional) HTML or text that will appear after the file name (if it exists)

5. Example 1, Return File

{exp:bn_file_exists:return_file src="http://whatevs.ext" wrap_left="<li>" wrap_right="</li>"}

6. Example 2, Return File

{exp:bn_file_exists:return_file wrap_left="<li>" wrap_right="</li>"}http://barrettnewton.com/whatevs.ext{/exp:bn_file_exists:return_file}

7. Example 3, Check File

{exp:bn_file_exists:check_file src="whatevs.ext"}

Version 1.0.0

Initial release