PHP/Laravel uploads very large files easily

We know that in the past, the file upload method was to directly upload the entire file, which is no problem for some small files. When uploading large files, this method is not only cumbersome to operate, but also needs to modify the configuration of the web server and the back-end language, but also occupies a large amount of server memory, resulting in a tight server memory, and even the transmission timeout or the file is too large to be uploaded. . Obviously, the ordinary file uploading method can no longer meet the higher and higher requirements.

With the development of technology, we can now use HTML5's block upload technology to easily solve this problem. By dividing large files into small blocks and uploading them one by one, the memory usage of the server can be reduced, and the server and back-end language configuration can be broken through. The upload size limit of , can upload files of any size, and also simplifies the operation, providing an intuitive progress display.

AetherUpload-Laravel is a Laravel extension package that provides large file upload. It supports group configuration, resumable upload after disconnection, second upload, distributed deployment and other functions. It is easy to use and meets the mainstream needs of most people. The non-perceptual design concept enables the extension to automatically take over upload and access requests. Developers can focus on the business, and do not need to care about the upload process or write adaptation code. It can be used almost out of the box, saving a lot of development time.

The main functional features are: percentage progress bar, file type and size limit, group configuration, custom middleware, upload completion event, synchronous upload, disconnected resuming, file transfer in seconds, distributed deployment.

Analyze the upload process, first send the preprocessing request preprocess to check whether it can be uploaded in seconds, filter the file size and type, and pre-create pointer header files and resource files. Then send the uploading request uploading in chunks, start the file uploading process in chunks, and start merging files at the same time, until the last chunk is uploaded, return the storage address of the complete file, and add the file to the second upload record.

The installation process is quite simple, no additional configuration is required, and it only takes 30 seconds to make your application support large file uploads.

Second upload example:         switch to the root directory of your laravel project in the terminal, and execute composer require peinhu/aetherupload-laravel ~2.0

(Laravel 5.5+ please skip) Add a line AetherUpload\AetherUploadServiceProvider::class in the providers array of config/app.php,

Execute php artisan aetherupload:publish to publish some files and directories

Visit http://domain/aetherupload in the browser to reach the sample page

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324114845&siteId=291194637