Slave a tutti, faccio un'upload con flash (con il solito flash.net.FileReference) , gestisco l'upload tramite php e fin qui tutto funge a meraviglia.
il mio problema è che al momento dell'upload flash salva il nome del file originale (file.name)e, dopo l'upload e il rename in php, se ne frega che in php ho rinominato il file.
ovviamente flash cerca un file da scaricare che non ha più lo stesso nome.
come faccio a passare il nome del file rinominato in php a flash prima del download?
questo è l'as filereference:
codice:
//Allow this domain
System.security.allowDomain("http://localhost/");
import flash.net.FileReference;
// The listener object listens for FileReference events.
var listener:Object = new Object();

// When the user selects a file, the onSelect() method is called, and
// passed a reference to the FileReference object.
listener.onSelect = function(selectedFile:FileReference):Void {
  //clean statusArea and details area
  statusArea.text = details.text = ""
  // Flash is attempting to upload the image.
  statusArea.text += "Attempting to upload " + selectedFile.name + "\n";
  // Upload the file to the PHP script on the server.
  selectedFile.upload("upload.php");
};

// the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void {
  statusArea.text += "Uploading " + selectedFile.name + "\n";
};
//Possible file upload errors
listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "HTTPError number: "+httpError +"\nFile: "+ file.name;
}

listener.onIOError = function(file:FileReference):Void {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "IOError: "+ file.name;
}

listener.onSecurityError = function(file:FileReference, errorString:String):Void {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "SecurityError: "+SecurityError+"\nFile: "+ file.name;	
}

// the file has uploaded
listener.onComplete = function(selectedFile:FileReference):Void {
  // Notify the user that Flash is starting to download the image.
  statusArea.text += "Upload finished.\nNow downloading " + selectedFile.name + " to player\n";
  //Show file details
  details.text = ""
  for(i in selectedFile) details.text +=""+i+": "+selectedFile[i]+"\n"
  // Call the custom downloadImage() function.
  downloadImage(selectedFile.name);
};

var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);

uploadBtn.onPress = uploadImage;
imagePane.addEventListener("complete", imageDownloaded);

// Call the uploadImage() function, opens a file browser dialog.
function uploadImage(event:Object):Void {
  imageFile.browse([{description: "Image Files", extension: "*.jpg;*.gif;*.png"}]);
}

// If the image does not download, the event object's total property
// will equal -1. In that case, display am error message
function imageDownloaded(event:Object):Void {
  if(event.total == -1) {
    imagePane.contentPath = "error";	
  }
}

// show uploaded image in scrollPane
function downloadImage(file:Object):Void {
  imagePane.contentPath =  "./files/" + file;
   }
stop();
e questo è il file upload.php dove faccio l'upload ed il rename randomico del file caricato.

Codice PHP:
// funzione per creare un codice alfanumerico (spero) univoco 
function makeRandomid() {
$pass "";
  
$salt "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  
srand((double)microtime()*1000000);
      
$i 0;
      while (
$i <= 7) {
            
$num rand() % 33;
            
$tmp substr($salt$num1);
            
$pass $pass $tmp;
            
$i++;
      }
      return 
$pass;
}

$nome $_FILES['Filedata']['name'];
$info pathinfo($nome); 
$ext $info['extension'];
$codice makeRandomid();
$nuovonome "$codice.".$ext;
// faccio l'upload e rinomino con il nuovo nome.
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$nuovonome);
chmod("./files/".$nuovonome0777); 
sicuramente bisognerà modificare il riferimento del nome del file in flash...
ma non saprei proprio dove... fatto un po di prove ma nisba..
mi sapreste aiutare?
thanks.