|
@@ -47,6 +47,7 @@ class UploadController extends Controller
|
|
|
$files = $request->file('image');
|
|
|
$fileCount = count($files);
|
|
|
$urls = [];
|
|
|
+ $path = $request->get('path') ? $request->get('path') . '/' : date('Ym') . '/';
|
|
|
for ($i = 0; $i < $fileCount; $i++) {
|
|
|
$kuoname = $files[$i]->getClientOriginalExtension();
|
|
|
$filePath = $files[$i]->getRealPath();
|
|
@@ -61,9 +62,9 @@ class UploadController extends Controller
|
|
|
//要保存的文件名 时间+扩展名
|
|
|
$filename = time() . '_' . uniqid() . '.' . $kuoname;
|
|
|
}
|
|
|
- $imageUrl = Storage::put($filename, file_get_contents($filePath));
|
|
|
+ $imageUrl = Storage::put($path . $filename, file_get_contents($filePath));
|
|
|
if ($imageUrl) {
|
|
|
- array_push($urls, config('customer.chxq_oss_url') . $filename);
|
|
|
+ array_push($urls, config('customer.chxq_oss_url') . $path . $filename);
|
|
|
} else {
|
|
|
Log::debug('文件上传失败。' . $filename);
|
|
|
}
|