problem with returning the filename using Uploadify

umershaikh

New Member
I am using the Uploadify Plugin to upload the picture, and i am doing some operations likea) when a user upload the file the upload button is removed automaticallyb) and the uploadify.php script will rename the file and store it in designated directory.and here is the code which i am using to perform the action.Jquery Code : \[code\]<script type="text/javascript">$(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('<a href='http://stackoverflow.com/questions/3645194/+fileObj.filePath+'>'+fileObj.name+'</a><br>'); $("#firstUpload").remove(); } }); }); </script>\[/code\]and in the php i have used the combination of date with a unique id to rename the file which is perfectly working fine.but when i want to view the file name and i do that by calling the div\[code\]<div id="filesUploaded"></div>\[/code\]it shows the original filename and not the renamed file. i tried changing the value from \[code\]'+fileObj.name+' to '+response+'\[/code\]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. how do i make it print the renamed file name.?thank youEdit : here is my PHP code .\[code\]<?phpinclude('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);}?>\[/code\]
 
Back
Top