Enable Windows Explorer previews for custom file types

Coders, have you ever wished if you get preview of source code while you are in Windows Explorer? Yes it is possible. You might know already that there is a “Preview Pane” feature present. According to a file’s Content Type the preview will be shown at the right side of the window. Common formats supported are – .txt, .mp4, .jpg etc.


BUT, most of the developer’s files like .cs, .php, .config, .log files are not supported by default and you will be presented with a message “No preview Available” like this:


How to enable preview for a specific filetype?

Step 1: Go to Regedit. Expand the node HKEY_CLASSES_ROOT

Step 2: look for your required extension, eg: .php (If the extension is not already present, then create a key)

Step 3: Add a string value PerceivedType and set its Data to text

Voila!, your file preview is ready!


Loop multiple videos in HTML5 video tag

<video id="v" autoplay>
       <source src="1.mp4" type="video/mp4">

         var c = 0;
         f = [
         var v = document.getElementById('v');
         v.addEventListener('ended', function(e) {
             c = (c < f.length-1)?++c:0;
             v.src = f[c];

Ajax file uploader using jQuery

Here is a sample code to upload multiple files using ajax, and without using the traditional <form> tags. Find the full source code in GitHub – https://github.com/ninethsense/code-share/tree/master/jQuery-File-Upload .

    <input type="button" value="Choose file" id="fup" />

    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>    

            $(function() {

                // Show file upload dialog on click of button

                    //Create File component
                    var fu = document.createElement("input");
                    fu.type = "file";

                    // Trigger file selection event
                        var fd = new FormData();
                        $.each($(fu)[0].files, function(i, file){
                            fd.append('file[]', file);

                        // Send fd to server
                            type: 'POST',
                            cache: false,
                            contentType: false,
                            processData: false,
                            success: function(d) {

                    // To invoke the file selection dialog box


Sample server code in PHP for the reference:

foreach ($_FILES['file']['tmp_name'] as $k => $v) {