Files Uploading on Amazon S3 server using Laravel 5.4 Part-2

Files Uploading on Amazon S3 server using Laravel 5.4 Part-2

In this Post We Will Explain About is Files Uploading on Amazon S3 server using Laravel 5.4 Part-2 With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Laravel 5 amazon s3 file upload Step By step Example

In this post we will show you Best way to implement php – Laravel 5.4:file upload to into aws s3 directly to bucket, hear for Uploading Directly To Amazon S3 From Laravel 5 Applicationwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

In this Second part I have last two step to make controller and crate blade view file for file simple upload file or video on amazon s3 server using Laravel 5 FileSystem.

In this Last second step, we shall use “Storage” Mode facade for all the upload file in simple amazon s3 server as well as also get CDN Mode url of uploaded All the files. Therefore Now follow simple bellow source code two step for full example finish of upload laravel using image upload in s3 server.

Step 5: Create Controller

In this last second point, now we need to make new controller as liveIMAGESs3Ctrl in this simple path app/Http/Controllers/liveIMAGESs3Ctrl.php. this view controller will manage all the layout and upload image validation with post data request, So run simple bellow command for success generate new controller:

php artisan make:controller liveIMAGESs3Ctrl

Ok, Ad then put bellow some content in controller file:

Following Path :app/Http/Controllers/liveIMAGESs3Ctrl.php

validate($request, [
            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
        ]);

        $your_imgname = time().'.'.$request->image->getClientOriginalExtension();
        $image = $request->file('image');
        $t = Storage::disk('s3')->put($your_imgname, file_get_contents($image), 'public');
        $your_imgname = Storage::disk('s3')->url($your_imgname);

    	return back()
    		->with('success','Good Luck.!!Image Uploaded successfully.')
    		->with('path',$your_imgname);
    }
}

Step 6: Create View




	step By step Laravel 5.3 Amazon S3 Image or video  Upload with Validation step by step  example
	



Laravel 5.3 Amazon S3 Image Upload with Validation example

@if (count($errors) > 0)
Whoops! There were some problems with your input.

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if ($data_message = Session::get('success'))
{{ $data_message }}
Files Uploading on Amazon S3 server using Laravel 5.4 Part-2 @endif
{{ csrf_field() }}

Now I Am ready to simple run your example therefor run bellow simple command ro all application quick run:

php artisan serve

Now I can open this bellow URL on Mozila your browser:

http://localhost:8000/s3-image-upload

Example

I hope you have Got What is amazon s3 Server Uploading Files using Laravel 5.4 And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment