doxbox / doxbox-dms

DoxBox DMS formerly Owl Intranet Knowledgebase
www.doxbox.ca
GNU General Public License v2.0
7 stars 18 forks source link

Add jQuery Validation on File Upload Form #6

Open bozzit opened 10 years ago

bozzit commented 10 years ago

Right now the when uploading a file, the file in its entirety is sent to the server before the user is made aware that there is already a file with that name in the target directory.

Ajax Validation could be made to check before Posting the Form.

on Trigger ... Something like.

  jQuery.getJSON('./scripts/Ajax/Owl/fileexists.php?sess='+ jQuery('#sess').val() + '&parent=' + jQuery('#parent').val() + '&filename=' <get filename from file input field>', function(data){

           if(data)
           {
              if (data.returnval == 1)
              {
                 alert ('File you are trying to upload already exists in the Target directory');
                 return false;
              }
           }
     });