src/ImportField.php
protected function preserveSourceDocument($tmpfile, $chosenFolderID = null)
    {
        $upload = Upload::create();

        $file = File::create();
        $upload->loadIntoFile($tmpfile, $file, $chosenFolderID);

        $page = $this->form->getRecord();
        $page->ImportedFromFileID = $file->ID;
        $page->write();

        return $file;
    }
protected function preserveSourceDocument($tmpfile, $chosenFolderID = null)
    {
        $upload = Upload::create();

        $file = File::create();
        $upload->loadIntoFile($tmpfile, $file, $chosenFolderID);

        $page = $this->form->getRecord();
        $page->ImportedFromFileID = $file->ID;
        $page->write();

        return $file;
    }
protected function preserveSourceDocument ( $ tmpfile , $ chosenFolderID = null ) { $ upload = Upload :: create ( ) ; $ file = File :: create ( ) ; $ upload -> loadIntoFile ( $ tmpfile , $ file , $ chosenFolderID ) ; $ page = $ this -> form -> getRecord ( ) ; $ page -> ImportedFromFileID = $ file -> ID ; $ page -> write ( ) ; return $ file ; }
Preserves the source file by copying it to a specified folder.

@param $tmpfile Temporary file data structure.
@param int $chosenFolderID Target folder.
@return File Stored file.
Preserves the source file by copying it to a specified folder .