Re: Options on sorted upload - Multi file select

  •  03-25-2011, 2:00 PM

    Re: Options on sorted upload - Multi file select

    I figure let me post a followup to this incase it can help someone else.
     
    the second call is nessessary, so i figured if I needed to use one I might as well make it usefull.
     
     
    in the JS file where I call
     
    function CuteWebUI_AjaxUploader_OnPostback() {
     
    // grab some additional info
       var stock = document.getElementById("Stock");
       var stockv = stock.value;

       var vinnum = document.getElementById("VIN");
       var vinnumv = vinnum.value;

       var picnum = document.getElementById("picnum");
       var picnumv = picnum.value;
     
       var uploader = document.getElementById("myuploader");
       var guidlist = uploader.value;
    // since i dont know how many photos the user will select or how long the guidlist will be , append known values to the end
       
       var guidlist2 = guidlist + "/" + didv + "/" + stockv + "/" + picnumv + "/" + vinnumv;
     
    * now when this posts to the  ajax-multifiles-handler.php, and we exploded the post array
     
    $guidarray=explode("/",$_POST["guidlist2"]);
     
    i can count backwards to get my added vars
       $numofarray = count($guidarray)-2;
          $pnum = $guidarray[$numofarray]; // this is the picture number im looking for
     
    since i know how many vars i added i know how many to take off to get to the original guidarray sent
     
    foreach($guidarray as $fileguid)
    {
     if($count<$numofarray3){ // is part of FileGuide
     $mvcfile=$uploader->GetUploadedFile($fileguid);
     
     if(!$mvcfile)
      continue;
    .... // process file here
     
    since i am moving the file and renaming it
    I added a extra member  my new filename  to the JSON array being echoed
     
    the returning xh.responseText
    var list = eval(xh.responseText); //get JSON objects
      list.sort(SortByFileName); // create a function to sort on the original filename uploaded
     
    then in the loop
     for (var i = 0; i < list.length; i++)
       {
       photostr.push(list[i].FileNewName);  // create an array with only the NEWName
          }
      
       photostr = photostr.toString().replace (/\,/g, '|');    // replace commas with pipes
     
    now i have a string of new filenames in the proper sorted order  based on the original name,
    the original files are on the server with the new name.
     
    now i need to get them into the db, with the new name
    here is where i make the second call with a jquery to  a php page that creates a thumbnail of the image & inserts it values into the db
     
    and thats pretty much it. 
     
    if you would like to see it working
     
    goto  www.dealz2wheelz.com  and login to the members area with   demotest / demotest
     
    click on inventory and add a new vehicle,  you ll see the photo tab,  ( No porn !! )
     
     
     
     
View Complete Thread