28 File Upload - Laravel 11 tutorial for beginners.

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

ความคิดเห็น • 8

  • @tonyxhepaofficial
    @tonyxhepaofficial  6 หลายเดือนก่อน +2

    28 File Upload - Laravel 11 tutorial for beginners.

  • @MarcelloPato
    @MarcelloPato 21 วันที่ผ่านมา

    Great work Tony! Can you tell us which font is this that you are using?

  • @sidymohamedcherifhaidara980
    @sidymohamedcherifhaidara980 หลายเดือนก่อน +1

    How uploaded file laravel with nuxt3

  • @juniorgeba25
    @juniorgeba25 6 หลายเดือนก่อน

    It would be interesting to show the management of multiple doc and pdf files

  • @chiqui1234ok
    @chiqui1234ok 3 หลายเดือนก่อน

    hi! what pluggin do you have for those snippets/help when you write laravel code?

  • @omidatash.peykar1139
    @omidatash.peykar1139 6 หลายเดือนก่อน +2

    You did not say how to display the same uploaded file

    • @radoslavrac8619
      @radoslavrac8619 4 หลายเดือนก่อน +1

      After successful image upload you can see your image in storage/app/public/[and_your_file_for_images], now you have to link app/public with just public file cuz image is uploaded to app/public but users can access only public file, not app/public. With this command: php artisan storage:link you will link this two files and now users can access images in app/public through just public file. After this step you have to display your image in blade, add this code: {{url('storage/'.$your_variable)}}
      Hope this helps 🤞

  • @rafablum
    @rafablum 5 หลายเดือนก่อน

    Hi Tony
    Through this tutorial I had some problems, as the image was not being deleted, the way I added the image in a non-public place and to show the image in the view, so here's how I improved it, in case anyone has the same problem.
    In view:
    in Controller Post
    update:
    $validate = $request->validate([
    'title' => ['required', 'min:3', 'max:255'],
    'content' => ['required', 'min:10', 'max:255'],
    'thumbnail' => ['nullable', 'image', 'mimes:jpg,png,jpeg,gif', 'max:2048']
    ]);
    if ($request->hasFile('thumbnail')) {
    if (Storage::exists($post->thumbnail)) {
    Storage::delete($post->thumbnail);
    }
    $validate['thumbnail'] = $request->file('thumbnail')->store('public/thumbnails');
    }
    $post->update($validate);
    store:
    $validate = $request->validate([
    'title' => ['required', 'min:3', 'max:255'],
    'content' => ['required', 'min:10', 'max:255'],
    'thumbnail' => ['nullable', 'image', 'mimes:jpg,png,jpeg,gif', 'max:2048']
    ]);
    $validate['thumbnail'] = $request->file('thumbnail')->store('public/thumbnails');
    auth()->user()->posts()->create($validate);
    delete:
    Storage::delete($post->thumbnail);
    $post->delete();