Wednesday 19 April 2017

Using the JavaScript FileReader API to Avoid File Upload Limits


If you’ve ever spent any amount of time messing with PHP configuration files to get a file to upload, you know that uploading large files can be a real pain. You have to find the loaded php.ini file, edit the upload_max_filesize and post_max_size settings, and hope that you never have to change servers and do all of this over again. I ran into this problem myself while working on WP Migrate DB Pro – one of the features that will be going into the next release is the ability to upload and import an SQL file. Since WP Migrate DB Pro is used on a wide variety of servers, I needed to create a reliable upload tool that can upload large files without hitting upload limits.
Meet the JavaScript FileReader API. It’s an easy way to read and process any sort of file without the need to upload the file to the server first. FileReader is now supported in all major browsers including Internet Explorer 10, making it a viable solution for just about any project.
With that in mind, let’s create a sample WordPress file upload plugin to take a look at the FileReader API and learn how to use it to process large file uploads.
Getting Started
Since the FileReader API is baked right
Source: https://managewp.org/articles/14907/using-the-javascript-filereader-api-to-avoid-file-upload-limits




source https://williechiu40.wordpress.com/2017/04/19/using-the-javascript-filereader-api-to-avoid-file-upload-limits/

No comments:

Post a Comment