0 Replies Latest reply on Mar 9, 2008 11:47 AM by thejokerman05

    Use ComboBox data in my PHP script?

      I have this code in Flex and want in my php script use the selectedItem.data to control which folder the uploaded file should target. I've included my attempt in the php file with no luck, anyone?

      var sendVars:URLVariables = new URLVariables();
      sendVars.projekt = ComboBox(projektNamn).selectedItem.data;

      var request:URLRequest = new URLRequest();
      request.data = sendVars;
      request.url = _strUploadUrl;
      request.method = URLRequestMethod.POST;
      _refUploadFile = new FileReference();
      _refUploadFile = listFiles.selectedItem.file;
      _refUploadFile.addEventListener(ProgressEvent.PROGRESS, onUploadProgress);
      _refUploadFile.addEventListener(Event.COMPLETE, onUploadComplete);
      _refUploadFile.addEventListener(IOErrorEvent.IO_ERROR, onUploadIoError);
      _refUploadFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onUploadSecurityError);
      _refUploadFile.upload(request, "file", false);

      In my PHP:
      switch ($_REQUEST['projekt']) {

      case "VISIT":

      echo $dir = "VISIT";


      $file_path = $_SERVER['DOCUMENT_ROOT']."/mockingbird/".$dir;

      $file_temp = $_FILES['file']['tmp_name'];
      $file_name = $_FILES['file']['name'];

      //checks for duplicate files
      if (!file_exists($file_path."/".$file_name)) {

      //complete upload
      $filestatus = move_uploaded_file($file_temp,$file_path."/".$file_name);

      if(!$filestatus) {
      $success = "false";
      array_push($errors,"Upload failed. Please try again.");

      else {
      $success = "false";
      array_push($errors,"File already exists on server.");


      $success = "false";
      array_push($errors,"No action was requested.");