PHP: Read Write File, Read Scan Directory

Here is PHP code to: 1) Read / Scan any directory 2) Read any file 3) Write to any file 1) Read or Scan directory Get all files and folders inside the directory. Three ways are shown below. a) Read/Scan directory using opendir() and readdir() function $dir = "/var/www/test"; $dh = opendir($dir); while (false !== … Read more

Magento: How to upload file?

In adminhtml, you might have the following code in any form. Here ‘logo‘ is the name of the input type file. Or, you may have any HTML Form with the File field in the frontend page. Remember that your form’s enctype should be multipart/form-data. $fieldset->addField('logo', 'file', array( 'label' => 'Small Logo', 'required' => false, 'name' … Read more

Multiple file upload using jQuery and PHP

This tutorial shows how easy it is to upload multiple files using jQuery and PHP. I have used jQuery MultiFile Plugin for this purpose. The input type file should have name in list format like “pic[]” and the class name of the input should be “multi”. <input type="file" name="pic[]" class="multi" /> Below is the complete … Read more