Codeigniter multiple file upload messes file extension

Faced the exact similar stuff 2 days ago but did it the old fashioned way hope it helps. try this .. function tester(){ $this->load->library(‘upload’); // NOTE: always load the library outside the loop $this->total_count_of_files = count($_FILES[‘filename’][‘name’]) /*Because here we are adding the “$_FILES[‘userfile’][‘name’]” which increases the count, and for next loop it raises an exception, … Read more

Sending XML data using HTTP POST with PHP

you can use cURL library for posting data: http://www.php.net/curl $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, “http://websiteURL”); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, “XML=”.$xmlcontent.”&password=”.$password.”&etc=etc”); $content=curl_exec($ch); where postfield contains XML you need to send – you will need to name the postfield the API service (Clickatell I guess) expects

CodeIgniter: 404 Page Not Found on Live Server

You are using MVC with OOPS Concept. So there are some certain rules. 1) Your class name (ie: controller name) should be start with capital Letter. e.g.: your controller name is ‘icecream’. that should be ‘Icecream’ In localhost it might not be compulsory, but in server it will check all these rules, else it can’t … Read more

How to avoid SQL injection in CodeIgniter?

CodeIgniter’s Active Record methods automatically escape queries for you, to prevent sql injection. $this->db->select(‘*’)->from(‘tablename’)->where(‘var’, $val1); $this->db->get(); or $this->db->insert(‘tablename’, array(‘var1’=>$val1, ‘var2’=>$val2)); If you don’t want to use Active Records, you can use query bindings to prevent against injection. $sql=”SELECT * FROM tablename WHERE var = ?”; $this->db->query($sql, array($val1)); Or for inserting you can use the insert_string() … Read more

PostgreSQL next value of the sequences?

RETURNING That’s possible with a single round-trip to the database: INSERT INTO tbl(filename) VALUES (‘my_filename’) RETURNING tbl_id; tbl_id would typically be a serial or IDENTITY (Postgres 10 or later) column. More in the manual. Explicitly fetch value If filename needs to include tbl_id (redundantly), you can still use a single query. Use lastval() or the … Read more

CodeIgniter: A Class/Library to help get meta tags from a web page?

You should have a look at this class: PHP Simple HTML DOM it works this way: include(‘simple_html_dom.php’); $html = file_get_html(‘http://www.codeigniter.com/’); echo $html->find(‘title’, 0)->innertext; // get <title> echo “<pre>”; foreach($html->find(‘meta’) as $element) echo $element->name . ” : ” . $element->content . ‘<br>’; //prints every META tag echo “</pre>”;

What are the differences between backtick and single quote? Can I use IF statement in a query as above?

In MySQL, backticks quote names, while single quotes create strings. If you have a column called select, MySQL would throw an syntax error when using this name without backticks — like in SELECT select FROM foo — as it would interpret it as keyword which may not occur there. This IF function can be used … Read more