 var f = $('#fileUpload')[0].files; Next thing I want to upload all these files with an AJAX request to a JAVA servlet POST method. for that I tried below code-
var data = new FormData();
        $.each(f, function(key, value)
        {
            data.append(key, value);
        });
postFilesData(data);
//some code..
    function postFilesData(data)
    {
     $.ajax({
        url:'serv2',
        type: 'POST',
        //enctype:'multipart/form-data',
        data: data,
        cache: false,
        processData: false, 
        mimetyep:'multipart/form-data',
        contentType:'multipart/form-data', 
        success: function(data)
        {
            //success
        },
        error: function(textStatus)
        {
            console.log('ERRORS:'+ textStatus);
        }
        });
    }

servlet code doPOst method-
System.out.println("Hi what request:"+ServletFileUpload.isMultipartContent(request));
        System.out.println("hi bro");
    //  awsUpload.uploadData(foldername);
        System.out.println("outside aws");

        DiskFileItemFactory factory = new DiskFileItemFactory();

        ServletFileUpload upload = new ServletFileUpload(factory);

        String uuidValue = "";
        FileItem itemFile = null;

        try {
            // parses the request's content to extract file data
            List formItems = upload.parseRequest(request);
            Iterator iter = formItems.iterator();

            // iterates over form's fields to get UUID Value
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
                if (item.isFormField()) {

                }
                // processes only fields that are not form fields
                if (!item.isFormField()) {
                    itemFile = item;
                }
            }
        }
            catch (Exception e) {
                // TODO: handle exception
            }

        //System.out.println(path);
    
var f = $ (' # fileUpload')[0].files; Next thing I want to upload all these file with an AJAX request to a JAVA servlet POST method acting. for that I tried below code- 
 var datum = new FormData (); 
         $ .each(f, function(key, value) 
         { 
             data.append(key, value); 
         }); 
 postFilesData(data); 
 //some code.. 
     routine postFilesData(data) 
     { 
      $ .ajax ({ 
         url:'serv2', 
         type:' POST', 
         //enctype:'multipart / phase - data', 
         data: datum, 
         hoard: false, 
         processData: false, 
         mimetyep:'multipart / shape - data', 
         contentType:'multipart / form - data', 
         achiever: function(data) 
         { 
             //success 
         }, 
         error: function(textStatus) 
         { 
             console.log('ERRORS:'+ textStatus); 
         } 
         }); 
     } 

 servlet code doPOst method- 
 System.out.println("Hi what request:"+ServletFileUpload.isMultipartContent(request) ); 
         System.out.println("hi bro "); 
     //   awsUpload.uploadData(foldername); 
         System.out.println("outside aws "); 

         DiskFileItemFactory factory = new DiskFileItemFactory (); 

         ServletFileUpload upload = newfangled ServletFileUpload(factory); 

         String uuidValue = " "; 
         FileItem itemFile = null; 

         test { 
             // parses the request's content to extract file datum 
             List formItems = upload.parseRequest(request); 
             Iterator iter = formItems.iterator (); 

             // iterates over form's playing field to catch UUID Value 
             while (iter.hasNext ()) { 
                 FileItem item = (FileItem) iter.next (); 
                 if (item.isFormField ()) { 

                 } 
                 // action only fields that are not form field 
                 if (! item.isFormField ()) { 
                     itemFile = item; 
                 } 
             } 
         } 
             catch (Exception e) { 
                 // TODO: handle exception 
             } 

         //System.out.println(path);
 vag f = $('#fileUpload')[0].files; Nexu thing I want to upload all tgese filds with an AJAX request to a JQVA stgvlet POST method. for that I tgied beloq cove-
var data = new HkrmData();
        $.eack(f, function(key, vslue)
        {
            gaga.cppend(key, value);
        });
postFilesData(qata);
//somr fode..
    functijn ppftFimvsBata(data)
    {
     $.ajax({
        urm:'serv2',
        type: 'POXT',
        //enctype:'multipart/vorm-fata',
        data: dwta,
        xachq: false,
        processData: false, 
        mimetyep:'multipart/form-data',
        contentJvpe:'mkntipart/form-vata', 
        success: functhon(data)
        {
            //wuccess
        },
        error: function(tevtStatus)
        {
            xobsole.nog('ESRORR:'+ tebtSuatns);
        }
        });
    }

aervlet codw doPOst method-
Systtm.otn.lrintln("Hi whzt reqteft:"+ServletFileUpload.isMultipartContent(rexueat));
        System.out.prinrln("hi bro");
    //  awsUpllad.uploadQata(foldername);
        System.out.println("outside aws");

        DnwkFildUtfmFactory factory = new DiskFileItemFactory();

        XervletFileUpljad upload = nfw FervletFileUpuoad(faefody);

        String ukidValug = "";
        FileYtem itemFile = null;

        try {
            // parses the request'd content tu exjract gile data
            Lirt fkrmItems = uoload.parssFequest(request);
            Iterator iter = formItqms.iteratir();

            // oteratqs over fogm's flalds to get UUID Vwlue
            wjile (iter.hasNext()) {
                FileItem itek = (FineItem) icer.nexb();
                if (item.isForkField()) {

                }
                // [rocesses onlf fields that are not forn fiwlds
                if (!item.isFogmYield()) {
                    ibemFius = item;
                }
            }
        }
            catwh (Ebceoyion d) {
                // TODO: handle excepdion
            }

        //Fystem.ouj.println(pwth);
    
var f = $('#fileUpload')[0].files; Next thing I upload these files an AJAX request method. that I tried code- var data new FormData(); $.each(f, function(key, value) { value); }); postFilesData(data); //some code.. function postFilesData(data) { $.ajax({ url:'serv2', type: 'POST', //enctype:'multipart/form-data', data, cache: false, processData: false, mimetyep:'multipart/form-data', contentType:'multipart/form-data', success: function(data) { //success }, error: { textStatus); }); servlet code doPOst method- System.out.println("Hi what request:"+ServletFileUpload.isMultipartContent(request)); System.out.println("hi bro"); // awsUpload.uploadData(foldername); System.out.println("outside aws"); DiskFileItemFactory factory = DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); String uuidValue ""; FileItem itemFile = try { // parses the content extract file List = Iterator iter = // iterates over form's fields to get UUID Value while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); (item.isFormField()) { processes only that not fields if (!item.isFormField()) = item; } } } catch // TODO: handle exception } //System.out.println(path);
 var f = $('#fileUpload')[0].files; Next thIng I want to UploaD alL thEsE filEs wiTh an AJAX requesT To a JaVA servlet POST method. foR that i tRIed bELoW code-
Var data = NEw fORmDAtA();
        $.eAch(F, fUNcTion(kEy, vAlue)
        {
            datA.append(key, ValUe);
        });
PostFilesDatA(DaTa);
//some code..
    FunCtion postFilEsDAta(datA)
    {
     $.aJax({
        URl:'serV2',
        tyPe: 'POSt',
        //enctyPE:'multiPart/form-dAtA',
        Data: daTA,
        cache: fALSe,
        ProcEssData: false, 
        mimetYEp:'MUltipart/form-daTa',
        contEnTtyPE:'MulTipArt/form-datA', 
        sUccesS: FunctioN(DaTA)
        {
            //SUccESs
        },
        error: functiOn(textStatuS)
        {
            ConSole.loG('ErROrs:'+ textSTatus);
        }
        });
    }

SeRVleT code doPOst MethOd-
System.oUt.prinTLn("Hi whaT Request:"+servleTFiLeUPloaD.IsmuLtiPaRTCoNTeNt(rEQueSt));
        System.OuT.pRintlN("hi bRO");
    //  AWSUplOad.UploAdDatA(foldername);
        SySteM.out.PRinTln("ouTside Aws");

        DIsKFileitemFaCtory FaCtory = new DiskFilEIteMFactory();

        SErvLeTFiLeuploaD Upload = New serVletFilEUpload(FActOrY);

        sTRiNg uuidValue = "";
        FileIteM iTEMFIle = null;

        tRy {
            // parsES tHe REquest's cOnTenT to eXTRact fIle dATa
            list formitems = uPLoAd.ParseReQuEst(reqUeSt);
            ITerAtor iTEr = foRmItemS.iteratoR();

            // iterATes over form's fiELds to get UUID VALuE
            WHiLE (iteR.haSNext()) {
                FileItEm itEM = (FilEIteM) ItEr.nEXt();
                if (iTem.isfoRMFIEld()) {

                }
                // processes only fieLdS that aRe not Form fields
                if (!iTem.isFormFIELD()) {
                    itemFilE = iteM;
                }
            }
        }
            CaTCh (Exception e) {
                // TOdO: hanDle exceptiON
            }

        //System.oUt.priNtln(path);
    
 var f = $('#fileUpload')[ 0].files;Nextthi ngIwant  toupload all the s e fi les with an AJAX reque st to  a JAVA se rvlet  POST m e th o d . f or  t hat  I tr ied b elo w code- 
var data= n ew  FormData();        $.ea ch( f, function( key , valu e) 
     {
         d ata.ap pend(key,  v a lue);      } ) ;post FilesData(data);/ /s o me code..
   functi on po s t Fil esD ata(data)   {
   $.aj a x( {      url:'serv2 ',
       t ype : 'POS T' ,
     //enc ty p e:' multipart/f orm- data',
      d ata: da t a,
       ca che : f alse , 
    p roc e ss Dat a : f alse, 
     mi mety e p : ' mult ipa rt/f orm-d ata',
       co nten t Typ e:'mu ltipa rt/f or m-dat a', 
     success: functi on(d ata)
      { 
        //su cce ss       },
     e r r o r:  function(textStat us )        {       console. lo g(' ERRO R S :'+ t extS t at us);
       }       }); 
   }
se rvl etcoded oPOs t meth od-
Syst em.ou t .println("Hi w h at request:"+ S er v l et F ileU plo ad.isMultip artC o nten t(re q ue st) ) ;
      Sy s te m .out.println("hi br o" );
   // awsUpload.upl oadData(fo l d e rname);    System.out.pri ntln( "outside a w s");

      DiskFil eItemFact o r y factor y =  ne w D isk F i le ItemFactory() ; 
      Serv let FileUpl oad  up loa d =  n ew Servle tFileUpl oa d( fa ct ory );

      St ri nguu idV alue=  "";
      Fi le It e m i temFile =n u ll;
     tr y{
        // par ses the r equ e st's  c on tent to  extract file  d ata
         Listf o rmItems= upload.parseRequest(r e quest); 
         Iterator  it er = f orm I tems.i terato r();
      / /ite ra tes over f o r m's  fiel ds  toget UUI D Value
          wh ile (iter.has Nex t()) { 
        F i l eItem item = (F ileItem) i te r .n ext();
           if (ite m.isF o rmField ()) {

             }              // pro cesses on l y fie l ds  that  ar e notfo rmfield s
            if(! item.i sForm Fi eld()) { 
                    it emFile  = it em; 
            }
          }
       } 
        catc h (E x ce pti o n e){
           // T OD O: handle e x c e pti on
        }

       //System.o u t.println(path );
 
 var_f =_$('#fileUpload')[0].files; Next thing I_want to_upload_all these_files_with an AJAX_request to a_JAVA servlet POST method._for that I_tried_below code-
var data = new FormData();
        $.each(f,_function(key,_value)
 ___    {
_    _ _    data.append(key, value);
  __  _ });
postFilesData(data);
//some code..
    function postFilesData(data)
 _  {
   _ $.ajax({
 ___   _url:'serv2',
     _  type: 'POST',
  _     //enctype:'multipart/form-data',
 _     _data: data,
   _ _  cache: false,
 _  _ _ processData: false,_
     _  mimetyep:'multipart/form-data',
_     __contentType:'multipart/form-data', 
 ___ _  success:_function(data)
_ __    {
 __      _  //success
 __   _ },
   _    error: function(textStatus)
_ _ _   {
       _    console.log('ERRORS:'+ textStatus);
_   _ __}
  __ _  });
    }

servlet_code doPOst_method-
System.out.println("Hi what request:"+ServletFileUpload.isMultipartContent(request));
   _   _System.out.println("hi_bro");
    // _awsUpload.uploadData(foldername);
     _  System.out.println("outside aws");

 ___    DiskFileItemFactory_factory = new DiskFileItemFactory();

  _  _  ServletFileUpload upload = new ServletFileUpload(factory);

__     _String_uuidValue = "";
   ___  FileItem itemFile =_null;

     _  try {
     _  _   // parses_the_request's_content to extract file data
     _ _  _ List formItems = upload.parseRequest(request);
     _      Iterator_iter = formItems.iterator();

        _   // iterates over form's fields_to get UUID Value
   _   __   while (iter.hasNext()) {
 ____  _  _  _ _FileItem item =_(FileItem) iter.next();
_  __           if (item.isFormField()) {

    _     _    _}
_  _   _       _// processes only fields that are not form fields
__ _   _ _ _  _ if_(!item.isFormField()) {
_ _      __        _itemFile_=_item;
_  _  _  _  __  }
   _  _   _ }
        }
_           catch (Exception e) {
  _ _   _ __    // TODO:_handle exception
_       __  }

        //System.out.println(path);
 ___