Posts

Showing posts with the label coding

File Upload preview

Image
< input type = "file" class = "form-control" name = "productPhoto1" onchange = " preview ('productPhoto1Src'); " />         function preview ( imgSrc ) {           var fileBlob = URL . createObjectURL ( event . target . files [ 0 ]);           $ ( "#" + imgSrc ). attr ( 'src' , test123 );                   }

How to use Formdata for file upload and data save using ajax

  var form = $( '#fileUploadForm' )[ 0 ]; var data = new FormData(form); data.append( "CustomField" , "This is some extra data, testing" ); $( "#btnSubmit" ).prop( "disabled" , true ); $.ajax({ type : "POST" , enctype : 'multipart/form-data' , url : "upload.php" , data : data, processData : false , contentType : false , cache : false , timeout : 600000 , success : function ( data ) { console .log(); },

PHP Barcode Generator

Image
  Step 1 :- First we have to create a form named index.php and paste below code : - <!DOCTYPE html> <html> <head>     <title></title>     <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> </head> <body>     <div class="container">             <div class="row">                 <div class="col-md-4">                             <form method="post">                                     <div class="row">           ...

Indian Mobile No. Validation using Javascript and Jquery

Image
  Type 1 Validation using Javascript : - <!DOCTYPE html> <html> <head>     <title>Indian Mobile No. Validation</title> </head> <body> <h1 style="text-align:center">Indian Mobile No. Validation</h1> <form>     <table align="center" border="30">              <tr>             <td>Mobile No.</td>             <td><input type="text" id="mobile" maxlength="10"  placeholder="Enter Your Mobile No."  /></td>         </tr>                  <tr>             <td colspan="2">                 <input type="button"...

Base URL Setting in Codeigniter

Copy below code and paste inside the config.php file in Codeigniter . You will get this file in Application/Config/config.php  $config['base_url'] = $config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ?  "https" : "http")."://".$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

How to take photo from mobile camera and upload it using php ?

 First we write front end code : - <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             }         ...

How to take photo from camera and its preview in Jquery Mobile ?

 Here you will get code for preview of image captured by your device.   <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             ...

how to upload file in jquery mobile using php ?

 First of all we need a folder to store uploaded file . Here I have upd named folder but its your choice to whatever you can named it . below is working code for file upload in jquery mobile . <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {          ...

How to upload file in core php ?

 Create any file name but care about its extension should be .php    <!DOCTYPE html> <html>     <head>         <title>File Upload</title>     </head>     <body>         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">             <input type="file" name="csv_file">             <input type="submit" name="submit">         </form>         <?php         if (isset($_POST['submit'])) {             echo "<p>" . $_POST['csv_file'] . " => file input successfull</p>"; ...

How to protect a class by an object creation by another class?

Answer : By making a constructor to private . Example :                      Class Dinesh                 { private Dinesh(){                 // Code will be here                        } }  

How to protect a class to be inherited ?

  Answer : By adding a final keyword in before class name . Example :                                  Class final Class_name                          { Code will be here }