MediaModel::pathUploads PHP Метод

pathUploads() публичный статический Метод

Return path to upload folder.
public static pathUploads ( ) : string
Результат string Path to upload folder.
    public static function pathUploads()
    {
        if (defined('PATH_LOCAL_UPLOADS')) {
            return PATH_LOCAL_UPLOADS;
        }
        return PATH_UPLOADS;
    }

Usage Example

Пример #1
0
 /**
  * Delete an uploaded file & its media record.
  *
  * @param int $MediaID Unique ID on Media table.
  */
 protected function trashFile($MediaID)
 {
     $Media = $this->mediaModel()->getID($MediaID);
     if ($Media) {
         $this->mediaModel()->delete($Media);
         $Deleted = false;
         // Allow interception
         $this->EventArguments['Parsed'] = Gdn_Upload::parse($Media->Path);
         $this->EventArguments['Handled'] =& $Deleted;
         // Allow skipping steps below
         $this->fireEvent('TrashFile');
         if (!$Deleted) {
             $DirectPath = MediaModel::pathUploads() . DS . $Media->Path;
             if (file_exists($DirectPath)) {
                 $Deleted = @unlink($DirectPath);
             }
         }
         if (!$Deleted) {
             $CalcPath = FileUploadPlugin::findLocalMedia($Media, true, true);
             if (file_exists($CalcPath)) {
                 @unlink($CalcPath);
             }
         }
     }
 }
All Usage Examples Of MediaModel::pathUploads