Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tim on Jun 13, 2009 20:05
open dhtmlx forum
vault hidden GET variables

Hello,

I am using the PHP samples w/ dhtmlxVault & dhtmlxGrid.

Is it possible to send hidden _GET variables to UploadHandler.php?

ie. I am using dhtmlxGrid to have the user select an item they wish to upload photos for. I would like to send the SelectedRowID along to UploadHandler.php, so I can associate the photos being uploaded with the item currently selected on the grid.

Great products...thanks!!

-Tim
Answer posted by Support on Jun 18, 2009 09:22

Hello,
This will be available in the next version, 1.3. It is coming this Friday. If you are a licensed user, please send us your lic. # by email, and we can upgrade your version.

Answer posted by Admin on Jun 19, 2009 12:15
New version 1.3 is released.
Answer posted by Tim on Nov 25, 2009 13:12
Hello, I am now using v.1.3 Standard Edition build 9639 of dhtmlxVault.

I am still trying to send hidden _GET variables and having no luck.

My vault script:
<body>

<table cellspacing=0 cellpadding=0><td>
<div style="float: left;" id="vaultDiv"></div>
<div style="float: left; margin: 0 0 0 10px; width: 300px;" id="folderDiv">
  <div id="treeBox" style="height:215px;background:#ededed;"></div>
  <div style="float: left;" id="selFolderTxt">Selected Folder: </div>
  <div style="float: left; padding: 0 0 0 5px;" id="selFolder">none</div>
</div>
</td>
</table>


<script>
    vault=new dhtmlXVaultObject();
    vault.setImagePath("../dhtmlxVault/codebase/imgs/");
            var currFolder = document.getElementById('selFolder').innerHTML;
            vault.setServerHandlers("db/UploadHandler.php",
                                    "db/GetInfoHandler.php?folderName="+currFolder,
                                    "db/GetIdHandler.php?folderName="+currFolder);
  vault.onAddFile = function(fileName) {
                var ext = this.getFileExtension(fileName);
                if (ext != "mp3" && ext != "jpg" && ext != "zip") {
                    document.getElementById('uploadStatus').innerHTML = "Select a JPG, MP3, or ZIP file.";
                    return false;
                } else return true;
            };

  vault.create("vaultDiv");
           
  var currFolder = document.getElementById('selFolder').innerHTML;
  vault.setFormField("folderName", currFolder);

     tree=new dhtmlXTreeObject(document.getElementById('treeBox'),"100%","100%",0);
    tree.setImagePath("../dhtmlxTree/codebase/imgs/csh_winstyle/");
    tree.enableCheckBoxes(false);
    tree.enableSmartRendering();

  tree.loadXML("xml/vaultFoldersXml.php");
  tree.attachEvent("onClick",onNodeSelect);

  function onNodeSelect(nodeId) {
  var currSel = nodeId.substr(24);
 
  document.getElementById('selFolder').innerHTML = currSel;
 
  }
 
</script>
</body>
-----------------------------

Here is my UploadHandler.php script:
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);

    $id  = $_GET['sessionId'];
    $id = trim($id);

    session_name($id);
    session_start();

$folderStr = date("F Y");
// check for this month's folder

if (!file_exists($folderName)) {
    mkdir($folderName, 0777,true);
    }

   
    $inputName = $_GET['userfile'];
    $fileName  = $_FILES[$inputName]['name'];
    $tempLoc   = $_FILES[$inputName]['tmp_name'];
    echo $_FILES[$inputName]['error'];

    $folderName = $_GET['folderName'];
    if(!$folderName || $folderName == "none") $folderName = "../../../uploads/" . $folderStr;
    else $folderName = "../../../uploads/" . $folderName;                                         

    $target_path = $folderName . "/" . basename($fileName);

$fileExt = findExt($fileName);
        if ($fileExt == "zip") {
    $newFile = explode(".",$fileName);
    $newName = "../../../uploads/" . $newFile[0];
    mkdir($newName,0777,true);
    $target_path = "../../../uploads/" . $newFile[0] . "/" . basename($fileName);
    }
   


    if(move_uploaded_file($tempLoc,$target_path))
    {
    if ($fileExt == "zip") {
    // change permission on $target_path to 0777
    chmod($target_path,0777);

    $zip = new ZipArchive;
    $zipFile = $target_path;
    if ($zip->open($zipFile) === TRUE) {
    $extractPath = "../../../uploads/" . $newFile[0] . "/";
    $zip->extractTo($extractPath);
    $zip->close();
    makeThumbs($extractPath);

    }
    }

    // create thumbnail
    if ($fileExt == "jpg") {
    $tnName = $folderName . "/" . "tn_" . basename($fileName);
    createthumb($target_path,$tnName,100,100);
    }


    // end upload session
    $_SESSION['value'] = -1;   
    }

----------------

I am trying to set up a list of folders, so users can upload to a specific folder. The $_GET['folderName'] variable does not seem to be passing to uploadHandler.php

Please help!
-Tim
Answer posted by Support on Nov 26, 2009 08:33
Hi,
They are sent using POST, please use corresponding code to read POST variables.