PHP code example of yilu-tech / file-center
1. Go to this page and download the library: Download yilu-tech/file-center library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yilu-tech / file-center example snippets
public function uploadImage(Request $request) // 文件上传
{
if ($request->has('cut')) { // 判断是否需要裁剪图片
$rules = [
'image' => ':8',
'src_w' => 's['bucket'] = 'equest->has('cut')) {
return $is_temp ? $server->storeTempWithCut($request->all()) :
$server->storeWithCut($request->all());
} else {
foreach ($request->file('images') as $item) {
$paths[] = $is_temp ? $server->storeTemp($item) : $server->store($item);
}
return $paths;
}
}