Example #1
0
 public static function move($temp_path, $original_name)
 {
     // Unless there's a security vulnerability being exploited, this method would only ever be used to move an uploaded file. Otherwise `File::store` would be used explicitly.
     if (!is_uploaded_file($temp_path)) {
         throw new \RuntimeException('Only uploaded files may be moved.');
     }
     return File::store($temp_path, $original_name);
 }
Example #2
0
 public function read($system_path)
 {
     if (!is_readable($system_path)) {
         $this->app->notFound(new Exceptions\Exception('The requested file is unreadable or does not exist at "' . $system_path . '".'));
         return;
     }
     $response = $this->app->response;
     $response->headers->set('Content-Type', File::getMimeType($system_path));
     $response->headers->set('Content-Length', filesize($system_path));
     readfile($system_path);
 }
Example #3
0
" alt="" <?php 
        __($size);
        ?>
 title="<?php 
        __(_e($value[File::NAME_KEY]));
        ?>
"></figure></li>
	<?php 
    }
    ?>
</ol>
<?php 
} else {
    $value = $property->getValue();
    $path = $value[File::PATH_KEY];
    $size = getimagesize(File::getSystemPath($path))[3];
    ?>
<figure>
	<img src="/uploads/<?php 
    __(_e($path));
    ?>
" alt="" <?php 
    __($size);
    ?>
 title="<?php 
    __(_e($value[File::NAME_KEY]));
    ?>
">
</figure>
<?php 
}
Example #4
0
 public function setUploadDirectory($directory)
 {
     Types\File::setSystemDirectory($directory);
 }
Example #5
0
        ?>
<a href="/uploads/<?php 
        __(_e($value[File::PATH_KEY]));
        ?>
" alt=""><?php 
        __(_e($value[File::NAME_KEY]));
        ?>
</a>
<input id="<?php 
        __(_e($property_id));
        ?>
" type="checkbox" name="<?php 
        __(_e($property->getName()));
        ?>
" value="<?php 
        __(_e(File::serialize($value)));
        ?>
" checked>
<?php 
    } else {
        ?>
<input type="file" id="<?php 
        __($property_id);
        ?>
" name="<?php 
        __(_e($property->getName()));
        ?>
">
<?php 
    }
}