Skip to main content

Posts

MP4 upload is not working in codeigniter or PHP

 .MP4 upload is not working in codeigniter or PHP If any file format upload is not working in codeigniter or in any php framework and showing error like "file format is not allowed" then we need to first get the correct mime type and then need to allow it. In codeigniter first print the file mime type by using the below code if ( isset ( $_FILES [ 'file_name' ][ 'tmp_name' ])) { $filePath = $_FILES [ 'file_name' ][ 'tmp_name' ]; $finfo = finfo_open (FILEINFO_MIME_TYPE); $fileType = finfo_file ( $finfo , $filePath ); finfo_close ( $finfo ); echo "Uploaded file type: " . $fileType ; } then add the printed filetype in the config/mimes.php config/mimes.php 'mp4' => array ( 'video/mp4' , 'application/octet-stream','PUT_HERE' ), 'MP4' => 'video/mp4' , Thanks

PHP 8 New Concepts

 PHP 8 New Concepts PHP 8 is a major update to the PHP programming language, which was released on November 26, 2020. It introduces several new features and improvements over the previous version, PHP 7. Here are some of the key new concepts introduced in PHP 8: Union Types: PHP 8 introduces union types, which allow for defining a variable or parameter that can accept multiple types. This allows for more flexibility in defining function signatures and can make it easier to write code that can handle different types of input. Named Arguments: PHP 8 introduces named arguments, which allow for passing arguments to a function by name, rather than position. This can make it easier to understand the purpose of each argument, and can make it easier to change the order of arguments. Attributes: PHP 8 introduces attributes, which are metadata that can be associated with classes, methods, properties, and other language constructs. They can be used to provide additional information about a co...

Mastering React and Redux Chapter 1

  Mastering React and Redux Chapter 1 React and Redux are two popular JavaScript libraries that are widely used in building web applications today. Both libraries are maintained by Facebook, and they work together seamlessly to provide an efficient and scalable solution for managing the state of an application. In this blog post, we will take a closer look at how React and Redux work together, and how they can be used to build robust and performant web applications. React, often referred to as React.js or ReactJS, is a JavaScript library that is used to build user interfaces. It is a component-based library, which means that an application is built using small, reusable components. Each component is responsible for rendering a specific part of the user interface, and they can be easily composed to create complex applications. One of the key advantages of React is its use of a virtual DOM (Document Object Model). This allows React to efficiently update the user interface when the un...

SOLUTION- Angular 404 Not Found error on refresh or redirect

 SOLUTION for Angular 404 Not Found error on refresh or redirect  Sometimes when we create a production version of angular app , We can face a issue of 404 not found Why 404 not found error showing on redirection on other page or on refresh ? Angular is SPA(single page application) so it use html5 history for redirection and we refresh or redirect , its not able to find that routes thats why it shows an error of not found   Solution We can solve this issue by multiple ways but one of the easiest way is using htaccess. So if you are using Apache server then you can create a file on your root folder and put below content in it RewriteEngine on RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ index.html [L] Now save this file and try to refresh or navigate to another page, It will work.

SOLUTION- The term 'create-react-app' is not recognized as the name of a cmdlet

Solution for create-react-app : The term 'create-react-app' is not recognized as the name of a cmdlet, function, script file,or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Sometimes when we try to run ' create-react-app yourappname' we get an error like "... create react-app is not recognized" To solve this issue , Please follow below steps 1. Use npx Try to run command like below.  npx create-react-app yourappname OR npx create-react-app yourappname --use-npm 2. Add NPM Path to windows Path manager(WINDOWS SOLUTION) Go to Environment Variables > Path  and add npm path there. You can follow below steps:- Then check npm path in your system and click on new and paste npm location there. Now try again, it will work :)

CakePHP bin cake: Permission denied terminal error

 CakePHP bin/cake: Permission denied error in terminal/cmd Sometimes when we try to run commands on our server or on linux system , terminal gives error like bin/cake: Permission denied and even if we logged in as a root user, still its gives error. To solve this error please run below command, that will give permission to bin/cake folder  chmod +x bin/cake The above command will work for CakePHP 3 and 4 , and if you are using old version then try to run below command chmod +x Console/cake After running above commands , CakePHP will allow to run commands through terminal Thank you

Laravel - Remove public from url

Solution - Laravel How to Remove /public from url Laravel is a most popular PHP framework and today we will solve most common issue with laravel  by removing /public from URL. This code is tested with Laravel 8(Latest) but it will work with Laravel 7, 5 version also. ISSUE When we move our site on live server and do not run our application through terminal and try to access website by entering url then we need to add /public to run it successfully, But its not good to keep /public in our website url that will not seo friendly and creates bad user experience. SOLUTION FOR LARAVEL REMOVE PUBLIC FROM URL Create a .htaccess file on your root directory and paste below code into .htaccess file and save it. try this code <IfModule mod_rewrite.c>     RewriteEngine On     RewriteRule ^(.*)$ public/$1 [L] </IfModule> or this one RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ ^$1 [N] RewriteCo...