SproutCMS

This is the code documentation for the SproutCMS project

function generateFromDisk()

Generates a fake upload, including a session entry and a temp symlink, from an existing file on disk.

This allows reuse of existing uploaded files on Form::chunkedUpload fields which support multiple files

Usage

string FileUpload::generateFromDisk ( string $filename , string $session_key , string $field_name );

Arguments

  1. string $filename
    The name of a file which exists in the files dir, e.g. 'image.jpg'
  2. string $session_key
    The session key used for file uploads, e.g. 'user-register'
           (see Fb::chunkedUpload)
  3. string $field_name
    The name of the field supplied to Fb::chunkedUpload, e.g. 'photos'

Exceptions thrown

  • InvalidArgumentException
    if the filename is invalid

Return value

  • string
    The filename of the newly generated symlink, which matches the naming format of files
            uploaded via the chunked uploader