problem with returning the filename using Uploadify
<p>I am using the Uploadify Plugin to upload the picture, and i am doing some operations like</p>

<p>a) when a user upload the file the upload button is removed automatically
b) and the uploadify.php script will rename the file and store it in designated directory.</p>

<p>and here is the code which i am using to perform the action.</p>

<p>Jquery Code : </p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $('#fileUpload, #fileUpload2').uploadify({ 
      'uploader': 'img/uploadify.swf',
      'script': 'uploadify.php',
      'folder': 'upload',
      'auto' : 'true',
      'cancelImg': 'img/cancel.png',
      'fileDesc': 'jpg/jpeg',
      'displayData': 'percentage',
      'fileExt': "*.jpg;*.jpeg",
      'sizeLimit' : '8388608',
      'fileDataName' : 'file',
      onComplete : function(event, queueID, fileObj, reposnse, data) 
      {
     $('#filesUploaded').append('&lt;a href='+fileObj.filePath+'&gt;'+fileObj.name+'&lt;/a&gt;&lt;br&gt;');
     $("#firstUpload").remove();
      }
      }); }); 
      &lt;/script&gt;
</code></pre>

<p>and in the php i have used the combination of date with a unique id to rename the file which is perfectly working fine.</p>

<p>but when i want to view the file name and i do that by calling the div</p>

<pre><code>&lt;div id="filesUploaded"&gt;&lt;/div&gt;
</code></pre>

<p>it shows the original filename and not the renamed file. i tried changing the value from <code>'+fileObj.name+' to '+response+'</code></p>

<p>i guess the problem is within the above code as the file.Obj.name prints the selected file name and not the processed file, and when i change it to +response+ it uploads the file and rename it but in the form page it does not print the renamed file name. and it freezes with the progress bar composing 100% progress. </p>

<p>how do i make it print the renamed file name.?</p>

<p>thank you</p>

<p>Edit : here is my PHP code .</p>

<pre><code>&lt;?php
include('database.php');
$date = date("dFY");
$query = "SELECT MAX(id) as max_id FROM news";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$max_id = $row['max_id']+1;
echo $max_id;
$file1 = "file_$date"."_$max_id.jpg";
if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];
    $targetPath = 'upload/';
move_uploaded_file($tempFile,$targetPath.$file1);
}
?&gt;
</code></pre>
