Beispiel #1
0
 public static function uploadFileLocal($fieldName, $fileName = null)
 {
     $fileInfo = self::getFileInfo($fieldName);
     if ($fileInfo === null) {
         return null;
     }
     // Upload all file to storage directory. Its temporary.
     $type = 'files';
     $uploadedFileName = $fileName == null ? $fileInfo->getName() : $fileName;
     $dstPath = FileUploader::getStorageDirectory($type) . $uploadedFileName;
     if (!$fileInfo->saveAs($dstPath)) {
         return null;
     }
     return $type . '/' . $uploadedFileName;
 }