0 Replies Latest reply on Aug 18, 2006 12:21 AM by cancrexo

    filereference issue & php

    cancrexo
      Hi. After uploading an image using the Fileference class, i need to

      know if it's moving & renamig is done oke in the server. I mean, i need to

      know if there is any error during the renaming process.
      For the upload i use this As code:

      .../
      var cadena="html/upload.php?idAnuncio="+idAnuncio;
      resultado=_parent.fotoMc.fileRef.upload(cadena);

      ../

      and the upload.php script:
      <?php
      $MAXIMUM_FILESIZE = 1024 * 65; // 65 KB
      if ($_FILES['Filedata']['size']>0 && $_FILES['Filedata']['size'] <=

      $MAXIMUM_FILESIZE) {
      if(move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$_FILES['Filedata']['name'])){
      echo "&error=0&"; // Everything OK
      }
      else{
      echo "&error=1&"; // Renamig failed :-(
      }
      }
      else{
      // No pic
      echo "&error=1&";
      }
      ?>

      Well. The question is how can i read the error variable (&error=1&). As u

      can c i've tried using

      resultado=resultado=_parent.fotoMc.fileRef.upload(cadena); but this

      only returns true if the file uploads sucessfully.
      Thx.