Load data from PHP

Hi guys, i have a little problem, but its a big problem for me. I dont understand, i have a upload web and all work fine. But i want to rename files with random numbers ( prevent replacing ) and i did it in PHP. But i have a little problem, before this change, link to uploaded file work fine. But now, when php rename file, flash show me just old name without rename. Someone know how to repair this problem ? I try it with

print "return_msg=$new_file_name";

. Script that change name is

$filename = $_FILES['Filedata']['name'];
$filename = str_replace(' ', '_', $filename);

And i want it loade back in flash. to show link on image. eg. ( www.mypage.com/images/50450imagename.png.

Now its show me just /imagename.png.

Please help me. :zipper: