Adding additional information to upload file results in empty field

Adding additional information to upload file results in empty field

nessinitsnessinits Posts: 86Questions: 27Answers: 0

Hi everyone,

I'm trying to add additional information while uploading a file, however the POST or GET data for foreign_id isn't stored in the database. What am I doing wrong?

            ->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/site/workload/documents/n__ID__.__EXTN__' )
                ->db( 'files', 'id', array(
                    'foreign_id'  => $_REQUEST['foreign_id'],
                    'filename'    => Upload::DB_FILE_NAME,
                    'filesize'    => Upload::DB_FILE_SIZE,
                    'web_path'    => Upload::DB_WEB_PATH,
                    'system_path' => Upload::DB_SYSTEM_PATH
                ) )

Kind regards,
nessinits

Replies

  • allanallan Posts: 63,480Questions: 1Answers: 10,467 Site admin

    Could you try:

    'foreign_id'  => function () {
        return $_REQUEST['foreign_id'];
    },
    

    Thanks,
    Allan

  • nessinitsnessinits Posts: 86Questions: 27Answers: 0

    Thanks Allan, that works.

  • nessinitsnessinits Posts: 86Questions: 27Answers: 0

    This discussion can be closed

This discussion has been closed.