Hello,
Does somebody know, how I can get a purged file upload in afterSave?
I would like to upload a ZIP file, unpack it and store it in my own location.
I checked the documentation here:
Traits - October CMS - 3.x
…and setup my code like this:
class Project extends Model
{
use \October\Rain\Database\Traits\Purgeable;
protected $purgeable = ['webproject_files'];
// relations
public $attachOne = [
'webproject_files' => 'System\Models\File',
];
/**
* @var string The database table used by the model.
*/
public $table = 'creationhandicap_project_project';
/**
* @var array Validation rules
*/
public $rules = [
'webproject_files' => 'nullable|file|mimes:zip',
];
// save webproject if there
public function afterSave()
{
$webprojectZip = $this->getOriginalPurgeValue('webproject_files');
dd($webprojectZip); // this is null
}
}
But the value $webprojectZip
is null in the dump.
Is it even possible the way I set it up?