We have seen file upload using PHP in previous tutorials PHP file upload but in this tutorial we will see how to save files to MySQL database using PHP.
You may be wonder why you would need to save file content into database rather than just into the file system. In situations where PHP application needs to put entire file then the preferred method would be to put the file into server’s file system and save the file path into the database.
However in situations, where an application needs to save the entire file content into database along with other data. In such cases you have to put the file content into MySQL’s BLOB data type field.
Continue reading “Save Files to MySQL using PHP”
This tutorial will show you how to upload multiple files using PHP. In this example the files are selected using the browse buttons and files are uploaded to the ‘uploads’ directory under root project directory. PHP script stores the files into the defined location and returns response as a success or failure message from the PHP script. As a validation step I have added only to check if you have selected at least one file for uploading or not.
You may want to read also PHP Single File Upload Example
This tutorial will give you more attachment link for uploading file, so you will click on Attach another file then you will get Choose File button to attach another file. If you do not want to upload the chosen file then you can delete the attached file using Delete link.
Continue reading “PHP Multiple Files Upload Example”
In this tutorial we will see the integration of AngularJS with PHP REST. We are going to create CRUD application using PHP REST API on server side and AngularJS is encapsulated within html file on client side. Thus the client will communicate with server asynchronously using AngularJS $http service.
Please read REST API CRUD Example in PHP, MySQL for server side before reading this tutorial.
Continue reading “AngularJS PHP REST CRUD Example”
In this tutorial I am going to show you how we can work with RESTful webservice or REST webservice in PHP PDO, MySQL.
The most important concept in REST is resources, which are identified by global IDs — typically using URIs. Client applications use HTTP methods (GET/ POST/ PUT/ DELETE) to manipulate the resource or collection of resources. A RESTful Web service is implemented using HTTP and the principles of REST. Typically, a RESTful Web service should define the following aspects:
The base/root URI for the Web service such as http://<host>/<appcontext/contextpath>/<url pattern>/<resources>.
The MIME type of the response data supported, which are JSON/XML/TEXT/HTML etc.
The set of operations supported by the service. (for example, POST, GET, PUT or DELETE). Continue reading “REST API CRUD Example in PHP, MySQL”
In this post I will show how we can remove the version number from CSS & JS files.
Many css and js files in the WordPress have the WordPress version number appended to their source. Therefore to improve the speed of website as much as possible we need to remove query strings from css and js files. When we analyze site’s page using any page speed analyzer such as Google’s Page Speed, YSlow or Pingdom, we are very likely to see suggestions to remove query strings from css and js files. This is a problem as many proxies will not cache the resources if it has a query string in the URL. Continue reading “Remove version from css & js files in WordPress”
In this example, I will explain how to create a zip file of multiple files using PHP.
Create below function to create a zip file from multiple files.
Continue reading “Create archive or zip using PHP”
This tutorial will show you how to upload a file using PHP. In this example the file is selected using the browse button and file is uploaded to the ‘uploads’ directory. PHP script stores the file into the defined location and returns response as a success or failure message from the PHP script. As a validation step I have added only to check if you have selected a file for uploading or not.
Continue reading “PHP File Upload Example”
This tutorial shows an example how to sort an array using asort() function available in PHP. The asort() function sorts an array by maintaining the index association.
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant.
Continue reading “PHP asort() example”
This tutorial shows an example how to sort an array using natsort() function available in PHP. The natsort() function sorts an array using natural order sorting algorithm.
This function implements a sorting algorithm that orders alphanumeric strings in the way a human being would read while maintaining key/value associations.
Continue reading “PHP natsort() example”