Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dhassanali/laravel-s3-browser-based-uploads

Open more actions menu

Repository files navigation

Laravel S3 Browser Based Uploads

Latest Version on Packagist Build Status Total Downloads License

Upload files to AWS S3 Directly from Browser

Installation

  • 1 Install the package via composer:
composer require hassan/laravel-s3-browser-based-uploads
  • 2 Publish the config file of the package.
php artisan vendor:publish --provider="Hassan\S3BrowserBasedUploads\ServiceProvider" --tag=config
  • 3 add your AWS settings
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=

Usage

use Hassan\S3BrowserBasedUploads\Facades\S3BrowserBasedUploads;

S3BrowserBasedUploads::getEndpointUrl()

S3BrowserBasedUploads::getFields()

// with another connection
S3BrowserBasedUploads::connection('another')->getFields();

Example

const formData = new FormData();

@foreach(S3BrowserBasedUploads::getFields() as $key => $value)
    formData.append('{{ $key }}', '{{ $value }}');
@endforeach

formData.append('Content-Type', file.type);
formData.append('file', file, file.name);

const request = new XMLHttpRequest();
request.open('POST', "{{ S3BrowserBasedUploads::getEndpointUrl() }}");
request.send(formData);

Check out the demo with Filepond

Or Using Credentials Routes

// use Hassan\S3BrowserBasedUploads\S3BrowserBasedUploads;

public function boot()
{
    S3BrowserBasedUploads::routes();
}

Security

If you discover any security related issues, please email hello@hassan-ali.me instead of using the issue tracker.

About

Upload files to AWS S3 Directly from Browser

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.