Function “lmb_fileUpload()”

Geschätzte Lektüre: 5 Minuten


mixed lmb_fileUpload(array $file,numeric $level,array $relation=null, boolean $uploadfrom=false, array $dublicate=array(),boolen $verbose=false)

Function for uploading single or multiple files into the DMS (./limbas_src/extra/explorer/filestructure.lib)

Summary of the parameters:

  • Information on the uploaded file using the array $file
  • Target folder
  • Link parameters
  • Optional file source
  • Handling duplicateds



Valid parameters of an uploaded file

  • $file[“file”] – string : absolute path of the uploaded file
  • $file[“file_name”] : string – name of the file
  • $file[“file_type”] : string – MIMETYPE of the file
  • $file[“file_archiv”] : boolean – true if zip archive should be unpacked


Valid folder ID to which the file should be copied


Data record or records to which the file should be linked. Fields of the type Link (field_type 11) and Upload (field_type 6) can be used.

  • $relation[“gtabid”][0] : Table ID
  • $relation[“fieldid”][0] : Field ID
  • $relation[“datid”][0] : Data record ID


Authorizes an upload from different sources without prior HTTP upload

  • 1 : import from internal system
  • 2 : import from a local path
  • 3 : import from external storage


Handles the process if the file already exists. The file name, folder and (if available) the link to a record are used for the duplicate check.

The parameter “typ” defines how the file should be handled.

The parameter “subj” can optionally contain a description text for versioning.

The parameter “existingFileID” can be used to provide a file ID that was found as a duplicate. In some cases you may want to check for yourself whether and which file exists as a duplicate and you can override the system’s internal duplicate search. This is relevant for the extension function “lmb_extendedFileUpload”.

  • $dublicate[“subj”] : version notice if versioning
  • $dublicate[“existingFileID”] : [numeric]
  • $dublicate[“typ”]  : overwrite, rename, versioning, skip, ignore
    • overwrite : File is overwritten, name stays the same
    • rename : File is renamed to “Copy of”
    • versioning : File is versioned, name stays the same
    • skip : File is not uploaded or created
    • ignore : File is saved with the same name


  • true : Forces a detailed output
  • false : The function only specifies the record ID of the imported file

Return value

Array from the processed file information if $verbose = true

  • $fl[“nextid”] : The assigned data record number of the table LDMB_FILES
  • $fl[“filesize”] : The file size
  • $fl[“filename”] : The final file name
  • $fl[“level”] : The folder ID
  • $fl[‘mimetype_id’] : The MimeType ID of the table LMB_MIMETYPES
  • $fl[‘mimetype’] : The MimeType
  • $fl[‘secname’] : The physical file name with which the file was stored in the file system
  • $fl[“md5”] : The MD5 key of the file
  • $fl[“vpid”] : The record ID of the reference file if the file was versioned


The upload function can be redirected via the fixed function lmb_extendedFileUpload(). This requires the function lmb_extendedFileUpload() in an extension file. If this is present, it will be executed at the beginning of the upload process. It can return TRUE or FALSE. If TRUE the file is either processed directly or the parameters are adjusted. If FALSE, the upload process is cancelled.

mixed lmb_extendedFileUpload(array &$file, numeric &$level, array &$relation, array &$dublicate)

The parameters can be overwritten directly in the function by reference.

The following parameters are supported:

  • $file
  • $level
  • $relation
  • $dublicate


Share this Doc

Function “lmb_fileUpload()”

Or copy link