Ejemplo n.º 1
0
 private function set_file_properties($file_path)
 {
     $ext = Util_file::get_image_type($file_path);
     $file_info = File::file_info($file_path);
     $this->file->size = $file_info['size'];
     $this->file->type = $file_info['mimetype'];
     if (empty($this->file->original_name)) {
         $this->file->original_name = $file_info['filename'];
     }
     if (!($this->file->name = \Site_Upload::make_unique_filename($ext, $this->options['filename_prefix'], $this->file->original_name, $this->options['upload_dir']))) {
         throw new FuelException('File already exists.');
     }
     $this->file->file_path = $this->options['upload_dir'] . str_replace($this->options['filename_prefix'], '', $this->file->name);
 }