[COMMON] Image Upload, File upload, Multiple Image,Files, filesystems, Route::controller full (ok)
https://www.itsolutionstuff.com/post/laravel-9-image-upload-example-tutorialexample.html
Ví dụ 0: Upload ảnh từ input bằng js
// ...
'public' => [
'driver' => 'local',
'root' => public_path('images'), // default storage_path("app/public);
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
// ...public function store(Request $request) {
// ...
if($request->image_customer) {
$image = $request->image_customer;
$name = time() . "_" . $image->getClientOriginalName();
Storage::disk('public')->put($name,File::get($image));
$customer->image_customer = $name;
}else {
$customer->image_customer = 'default.png';
}
// ...
$customer->save();
}Ví dụ 1: Thực hành với ảnh html
Ví dụ 2: Thực hành với file pdf, .docx ...

Ví dụ 3: Multiple Image Upload

Ví dụ 4: Multiple File Upload
Tìm hiểu về File Storage của Larave
Tìm hiểu về File Storage của Laravel
Xem thêm tại: Tìm hiểu về File Storage của Laravel
Giới thiệu
Config
Local
S3 driver
FTP Driver
Thao tác với các disk
Mặc định:
S3:
Rackspace
Thao tác với các file
Để lấy nội dung file:
Để kiểm tra file có tồn tại không
Để lấy URL của file
Lưu tạm file (chỉ hỗ trợ s3 và rackspace)
File Metadata
Copy và moving file
Upload file
Upload dưới tên khác
Upload vào ổ đĩa khác
Xóa file
Thao tác với thư mục
Lấy các file trong thư mục
Lấy tất cả các file con trong thư mục cùng với tất cả các file trong các thư mục con
Tạo thư mục
Xóa thư mục
Previous[COMMON] Use Product::create($request->all()), $product->update($request->all()) thay $p->save (ok)Next[COMMON] validator->fails, ajax, unique full (ok)
Last updated