pastebin

Paste Search Dynamic
Recent pastes
uploader
  1. var http=createRequestObject();
  2. var uploader="";
  3. var uploadDir="";
  4. var dirname="";
  5. var filename="";
  6. var timeInterval="";
  7. var idname="";
  8. var uploaderId="";
  9. var filelength="";
  10. var fileext="";
  11.  
  12. function createRequestObject() {
  13.     var obj;
  14.     var browser = navigator.appName;
  15.     if(browser == "Microsoft Internet Explorer"){
  16.         return new ActiveXObject("Microsoft.XMLHTTP");
  17.     }
  18.     else{
  19.         return new XMLHttpRequest();
  20.     }  
  21. }
  22. function traceUpload() {
  23.         //alert('inside traceupload');
  24.    http.onreadystatechange = handleResponse;
  25.    http.open("GET", 'imageupload.php?uploadDir='+uploadDir+'&filename='+filename+'&uploader='+uploader+'&fileext='+fileext+'&uploaderId='+uploaderId);
  26.    http.send(null);  
  27. }
  28.  
  29. function handleResponse() {
  30.                
  31.         if(http.readyState == 4){
  32.                 var response=http.responseText;
  33.        
  34.         //      if(response.indexOf("File uploaded") != -1){
  35.                         //alert("clear time interval");
  36.                         //clearInterval(timeInterval);
  37.                         //document.getElementById('loading'+idname).innerHTML="";
  38.         //      }
  39.         alert(response);
  40.         document.getElementById(uploaderId).innerHTML=response;
  41.     }
  42.     else {
  43.                
  44.         document.getElementById(uploaderId).innerHTML="Uploading File. Please wait...";
  45.     }
  46. }
  47.  
  48. function uploadFile(obj, dname) {
  49.        
  50.         uploadDir=obj.value; // name of the file
  51.         idname=obj.name; // id1
  52.  dirname=dname; //empty
  53.         filename=uploadDir.substr(uploadDir.lastIndexOf('\')+1);
  54.        //alert(uploadDir);
  55.         //alert(filename);
  56.         uploaderId = 'uploader'+obj.name; // uploaderid1
  57.        uploader = obj.name; // id1
  58.        filelength = parseInt(filename.length) - 3; // sara
  59.        fileext = filename.substring(filelength,filelength + 3);  // sara
  60.         //document.writeln("Please Wait While the CV is being Upload");
  61. //      document.getElementById('uploader'+obj.name).innerHTML = 'Please Wait while the CV is being Upload!';
  62.  
  63.         alert("You will Soon receive a message regarding the CV Upload .. Please Wait");
  64.        document.getElementById('formName'+obj.name).submit();
  65.        
  66.         // traceUpload();
  67.         // timeInterval=setInterval("traceUpload()", 4000);
  68. }
Parsed in 0.016 seconds