Sunday, 31 March 2019

File preview before upload : HTML

     <title>File upload preview</title>
     <link rel="stylesheet" href="">
     <script src=""></script>
     .fileUpload {
        position: relative;
        overflow: hidden;
        margin: 10px;
        margin-top: 0px;

    .fileUpload input.upload {
           position: absolute;
           top: 0;

Friday, 29 March 2019

Check empty file using jquery

When you use file control from the input tag then for validation purpose you need to check the file name. if no file is selected then an error message should be displayed. This post will help you to achieve the same. When a user doesn’t select a file and an attempt is made to read file name then JS engines throw an exception which must be caught otherwise you will not be able to read and validate the empty file.

Wednesday, 27 March 2019

Sketch effect to a picture using photoshop

  1. open a picture in photoshop and make a duplicate layer by pressing Cntl+J

  2. Select huge saturation from create or adjustment layer tool 

Sunday, 24 March 2019

Friday, 22 March 2019

Insert record in Database

This post will help you to learn the basics of inserting the record in the database using ci framework.

Table Structure

Auto number(int)


$db['default'] = array(
=> '',
=> 'localhost',
=> 'username',
=> 'password',
=> 'db_name',
=> 'mysqli',
=> '',
=> (ENVIRONMENT !== 'production') ,
=> '',
=> 'utf8',
=> 'utf8_general_ci',
=> '',

Sunday, 3 March 2019

File upload with new name (PHP)

This post will help you to upload an image file to server with new name . File name will be database auto increment field value . So no name conflict will be arise.

function SaveSliderImage($file)

$stmt = $this->conn->stmt_init();
if ($stmt->prepare("insert into  ueks98_si_jsj_os9 (id,id1,id2)   values(NULL,?,?)"))
//Get File Extension

Show file on HTML page using file control

This post will help you to show preview of selected file from html file control because by default HTML file control only show the selected file name. So file preview is best way to show user that whether he is selected right file or not.


<input type="file" id="bfile" id="bfile" class="form-control" accept="image/x-png,image/jpeg" onChange="readURL(this)">

<br><img id="blah" style="margin:auto;display:block" />


function readURL(input) {