require "fci.pl";
# Most common methods shown here. See METHODS for others.
# import a file to a custom location open(FH $fname); file_import_custom($registered_id, FH, "P35/images/photo.gif");
# import a file to a default location open(FH, $fname); file_import_default($registered_id, FH, "gif");
# lookup the path of a file by id $fdest = file_path($registered_id2);
$mime_type = file_mime_type($filename);
CGI programmers will not normally access these functions directly. Instead, they should use repo_import_file, repo_register_file, etc. in repo.pl, or the higher-level file visualization methods in gateway.pl.
The FSA has two partitions: the Custom area and the Default area. In the Default area, files are assigned a location based on their file id (hashed across multiple directories to avoid the inefficiency of having thousands of files in a single directory). This frees the programmer from having to identify a unique name for every file registered in the system. In the Custom area, files are organized in human-readable paths defined by the programmer who submits the file. This allows the user to keep some metadata redundant in the file path, which allows files to be recognized without the accompanying metadata in the database.
Uses DBM file WRM_FSA_INDEX to associate File object IDs with file pathnames.
$fh into File Storage Area,
using $custom_dest as the destination location, rooted in the
FSA custom area. Saves the location in the WRM_FSA_INDEX dbm file. Returns
FSA destination of imported file. Creates subdirs in custom FSA area as
needed.
Returns 0 if import fails.
Parameter $fid will become the lookup key for retrieving the
file contents, stored in WRM_FSA_INDEX. The $fid value should
have been generated from repo_register_file (see repo.pl), which must be
exectued BEFORE calling file_import.
$id value. The file
extension ($ext) must be supplied.