Upload Multiple Files or Images in Codeigniter using Ajax JQuery

Source Code Controllers – Upload_multiple.php <?php defined(‘BASEPATH’) OR exit(‘No direct script access allowed’); class Upload_multiple extends CI_Controller { function index() { $this->load->view(“upload_multiple”); } function upload() { sleep(3); if($_FILES[“files”][“name”] != ”) { $output = ”; $config[“upload_path”] = ‘./upload/’; $config[“allowed_types”] = ‘gif|jpg|png’; $this->load->library(‘upload’, $config); $this->upload->initialize($config); for($count = 0; $count<count($_FILES[“files”][“name”]); $count++) { $_FILES[“file”][“name”] = $_FILES[“files”][“name”][$count]; $_FILES[“file”][“type”] = $_FILES[“files”][“type”][$count]; […]

Read More

MySQL query to select events between start/end date

I have a MySQL table named ‘events’ that contains event data. The important columns are ‘start’ and ‘end’ which contain string (YYYY-MM-DD) to represent when the events starts and ends. I want to get the records for all the active events in a time period. Events: —————————— ID | START_DATE | END_DATE | —————————— 1 […]

Read More

POST method using curl

Post data to a url using CURL in PHP Simple Code :- <?php # Our new data $data = array( ‘user’ => 2, ‘pass’ => ‘2Test’ ); # Create a connection $url = ‘https://www.shivrajan.com/curl/get.php’; $ch = curl_init($url); # Form data string $postString = http_build_query($data, ”, ‘&’); # Setting our options curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, […]

Read More

php url crawler

Crawl a webpage for all url Method – 1 <?php function crawl_page($url, $depth = 5) { $arr = array(); static $seen = array(); if (isset($seen[$url]) || $depth === 0) { return; } $seen[$url] = true; $dom = new DOMDocument(‘1.0’); @$dom->loadHTMLFile($url); $anchors = $dom->getElementsByTagName(‘a’); foreach ($anchors as $element) { $href = $element->getAttribute(‘href’); if (0 !== strpos($href, […]

Read More

Use command-line tools in PHP

Run shell commands in your Web applications Command-line overview This article considers the tools built into PHP that allow you to tap into the underlying shell environment and file system PHP is running on. PHP provides a number of functions for executing external commands, among them shell_exec(), exec(), passthru(), and system(). These commands are similar, […]

Read More