Vytvoření FileUpload ze souboru na disku nebo z url
- h4kuna
- Backer | 740
Jasně,
viděl bych to nějak takto
<?php
$fileUpload = new \Nette\Http\FileUpload([
'name' => basename($filePath),
'size' => filesize($filePath),
'tmp_name' => $filePath,
'error' => UPLOAD_ERR_OK,
]);
?>
Edit Factory funkce
<?php
function createFilUpload(string $filePath): \Nette\Http\FileUpload {
return new \Nette\Http\FileUpload([
'name' => basename($filePath),
'size' => filesize($filePath),
'tmp_name' => $filePath,
'error' => UPLOAD_ERR_OK,
]);
}
$fileUpload = createFilUpload($filePath);
?>
Editoval h4kuna (1. 10. 2018 14:07)