mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
use tmp_files on upload file
This commit is contained in:
@@ -128,7 +128,20 @@ class UploadController extends Controller
|
|||||||
try {
|
try {
|
||||||
// Add file extension, so mediavorus can guess file type for octet-stream file
|
// Add file extension, so mediavorus can guess file type for octet-stream file
|
||||||
$uploadedFilename = $file->getRealPath();
|
$uploadedFilename = $file->getRealPath();
|
||||||
|
$renamedFilename = null;
|
||||||
|
|
||||||
|
if(!empty($this->app['conf']->get(['main', 'storage', 'tmp_files']))){
|
||||||
|
$tmpStorage = \p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'tmp_files'])).'upload/';
|
||||||
|
|
||||||
|
if(!is_dir($tmpStorage)){
|
||||||
|
$this->getFilesystem()->mkdir($tmpStorage);
|
||||||
|
}
|
||||||
|
|
||||||
|
$renamedFilename = $tmpStorage. pathinfo($file->getRealPath(), PATHINFO_FILENAME) .'.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
}else{
|
||||||
$renamedFilename = $file->getRealPath() . '.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
|
$renamedFilename = $file->getRealPath() . '.' . pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
$this->getFilesystem()->rename($uploadedFilename, $renamedFilename);
|
$this->getFilesystem()->rename($uploadedFilename, $renamedFilename);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user