[gw_uploads]

Description

Link: [gw_uploads]
Author: Greg Willits
Category: Utility
Version: 6.x
License: Public Domain
Posted: Nov. 13, 2007
Updated: Nov. 13, 2007
More by this author...

I've spun yet another variation of an upload routine:

  • checks the file type against a config array to be sure it is an allowed format. The server config may allow many formats, but there needs to be an application-specific way of choking that list down as needed. This does that.
  • checks against a maximum upload file size config var, and rejects the file if larger.
  • accepts a target path and a list of input form field names to be moved to that path. This allows forms with multiple files to be spread amongst several folders. Use the tag multiple times to specify the path and field list. (see example below)
  • creates variables of the name equal to the input form field name with a value of the post-processed real file name (i.e. devoid of Windows path). These can be used just as if the field was a standard action_param converted to a var (which can then feed right into your database add|update routines).
  • creates an array of complete path names and file sizes to use for post processing (i.e. imagemagick)
  • creates a delimited string of files that were rejected (not an array because of my FWPro error management code). Automatically prevents redundant errors from multiple passes by the tag.

 

Parameters

-path string, required Destination path.
-flds string, optional Comma separated list of form field names.

Sample Usage

// first, upload files to folderA
fwpFile_uploads:
   -path='/folderA',
   -flds='u1,u3';
// next, upload files to folderB
fwpFile_uploads:
   -path='/folderB',
   -flds='u2,u4';
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

gw_uploads.zip (3.54 kb)

 

Comments

none

Email:


Password:



Newest

Most Popular