In Chapter 4, Building Custom Modules with Plugin Development, we created a plugin to upload attachments to posts. However, we had to select a file and upload files one by one while updating the post for each file. This is not ideal in situations where we have many files to be uploaded. Instead, we have to use AJAX and let the user upload multiple files without refreshing the browser. Before moving into the process of uploading files, we need to add the necessary scripts to the plugin. First, you have to create a new directory inside wpquick-woo-product-files as js, and create a new file called wqwpf-admin.js. Next, we can add the script to the plugins, as shown in the following code:
add_action( 'admin_enqueue_scripts', ...