Search
 
SCRIPT & CODE EXAMPLE
 

PHP

upload video file using ajax php

$('#save').on('click', function() {
       	$("#save").attr("disabled", true);

         var form = $('#form').val();
         var uname = $('#uname').val();
         var ufile= $('#ufile').val();

           if(uname!="" && ufile!=""){
        $(".uk-progress").show();
             $.ajax({
                 url: "include/upload.php",
                 type: "POST",
                  data:  new FormData(document.getElementById("form")),
                 contentType: false,
                 processData:false,
                 cache: false,
                 success: function(dataResult){
                    console.log(dataResult);  
                    $('#form').trigger("reset"); 
                    $('#save').removeAttr("disabled");
                     setTimeout(function(){
                       $('.uk-progress').hide();
                     }, 3000);
                    UIkit.notification({message: 'Success...', status: 'success',pos: 'bottom-center'})   

                 },
                 xhr: function() {
                var xhr = new window.XMLHttpRequest();
                xhr.upload.addEventListener("progress", function(evt) {
                    if (evt.lengthComputable) {
                        var percentComplete = Math.ceil((evt.loaded / evt.total) * 100);
                        $(".uk-progress").width(percentComplete + '%');
                        $(".uk-progress").html(percentComplete+'%');
                    }
                }, false);
                return xhr;
            },
                 error:function(dataResult){
                     console.log(dataResult);
                     $('#save').removeAttr("disabled");
                     UIkit.notification({message: 'Error...', status: 'danger',pos: 'bottom-center'})  
                 }
             });
             }else{
             	 $('#save').removeAttr("disabled");
             	 UIkit.notification({message: 'Required All Input Field...', status: 'danger',pos: 'bottom-center'})  
             }
             
        
         });
Comment

PREVIOUS NEXT
Code Example
Php :: he PHP exec() function must be enabled. 
Php :: Laravel - How to create custom configuration variables and access 
Php :: how to clear post array on referesh + not refill when return 
Php :: magento 2 get layout create block with cache 
Php :: composer new project laravel acl 
Php :: if condition in laravel blade in select option 
Php :: php endif endforeach endwhile 
Php :: laravel api routes 
Php :: run drush command from php 
Php :: Extract all audio tracks / streams 
Php :: symfony 6 download 64 bit 
Php :: Insert Data Into MySql Database Multiple Columns PHP Function 
Php :: laravel helper functions 
Php :: php post data empty 
Php :: php string filter email 
Php :: update php version cpanel 
Php :: Target class [AppHttpControllersAdminUserController] does not exist. larvel 8 
Php :: random number php 
Php :: function with parament php 
Php :: authenticate user with phone laravel 
Php :: tackel discount in javascript 
Java :: androidx recyclerview dependency 
Java :: getcolor deprecated 
Java :: how to create a button with javascri[t 
Java :: spring application properties mysql jpa 
Java :: zufallszahlen in java 
Java :: java selenium open new tab 
Java :: spigot run task later 
Java :: concatenating two int in java 
Java :: java ip regex 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =