Codeigniter No input file specified error for inside pages

If you are getting no input file specified error for inside pages in Codeigniter, this is the issue with htaccess redirection you have to replace your root htacces file with below code. if you look on the code you can see a question mark after the index.php (index.php?/$1) .This .htacces making the correct URL redirection in Codeigniter


RewriteEngine On
# Disable directory browsing 
#Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]  

PHP curl request code with Content Type application/json in header

Here is the PHP curl request code with Content Type application/json in header

$url = '' ; 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' )); 
          
$server_output = curl_exec($ch);
if(curl_exec($ch) === false)
{
    echo 'Curl error: ' . curl_error($ch);
}
else
{
    //echo 'Operation completed without any errors';
}

Simple PHP code to upload a file (pdf , doc,docx)

Here is the simple php code to upload a pdf file

/* file upload */

 $allowedExts = array("pdf", "doc", "docx"); 
 $targetfolder = $resume_upload_path; // UPLOAD path e.g '/home/public_html/upload'
 $random_num=rand(1000,9999);
$targetfolder = $targetfolder . $random_num.str_replace(' ', '_', basename($_FILES['resume_pdf']['name'])) ;
$targetpath = $root_upload_path . $random_num.str_replace(' ', '_', basename($_FILES['resume_pdf']['name'])) ;

$file_type=$_FILES['resume_pdf']['type'];
$extension = end(explode(".", $_FILES["resume_pdf"]["name"]));


 if ( 12000 < $_FILES["resume_pdf"]["size"]  ) {
 echo "error";  
 exit;
 }

 if ( ! ( in_array($extension, $allowedExts ) ) ) {

  echo "error";  
    exit;
  
 }
 $file_path="";
 if(move_uploaded_file($_FILES['resume_pdf']['tmp_name'], $targetfolder))

 {

 $file_path=$targetpath ;

  }

 else {


  echo "error";  
    exit;
 

 }
 
/* file upload end*/

where $file_path is the path of uploaded file

what is the usage of python lambda functions

Lambda is a keyword used to create an functions without a name or in simple lambda is used to create an anonymous functions,lambda function has n number of argument with a single expression which is processed and returned the result.we know normally a function is defined in python using def statement followed by function name and argument after evaluating it should return the result to get the result value when function is called but lambda has no name and return statement

Syntax Lambda functon

lambda arguments : expression

Example

Tenpercentage= lambda x :x * 10/100  

#"x" is an argument and "x * 10/100" is an expression which got evaluated and returned.   

print(Tenpercentage(200))

print(Tenpercentage(450))

Output

python lambda functions

See above code in Normal functions syntax

def Tenpercentage(n):
  return n * 10/100

print(Tenpercentage(450))

common usage of python lambda functions

Lambda function perform well if we use lambda functions inside another function see example

See example


def currency_convert(currencyvalue):  
    return lambda x:x*currencyvalue;

Israelicurrency=currency_convert(3.48);  #find dollar to Israeli New Shekel

print(Israelicurrency(100));

print(Israelicurrency(900));


indiancurrency=currency_convert(71.57);  #Find dollar to INR

print(indiancurrency(100));

print(indiancurrency(900));

python lambda functions inside anothor function