I am making a script to upload image files to one of many albums(dynamic). But i stuck at end, cannot retrive tmp_file(uploaded file) to move it to album. I am using uploadify v2.1.4
Here is my script. This is my javascript upload form.
$(document).ready(function(){
//aleart('I am Ready!');
$("#file_upload").uploadify({
'uploader': 'upload/uploadify.swf',
'cancelImg': 'upload/cancel.png',
'auto': false,
'multi' :true,
'folder': 'uploads',**strong text**
'method' : 'post',
'queueSizeLimit' : 10,
'onQueueFull' : function(event, queueSizeLimit){
alert(" You can upload " + queueSizeLimit + " files at once");
return false;
},
'onComplete': function(event, ID, fileObj, response, data) {
var album_id = $("#album_id option:selected").val();
$.post("uploadify.php", { "name": fileObj.name, "tmp_name": fileObj.tmp_name, "path": fileObj.filePath, "size": fileObj.size, "album_id":album_id}, function(info){
alert(info);
});
}
});
});
</script>
</head>
<body>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file_upload" id="file_upload" />
<select id="album_id" name="album_id">
<?php foreach ($albums as $album) {
echo '<option value="', $album['id'], '">', $album['name'],'</option>';
} ?>
</select>
<a href="javascript:$('#file_upload').uploadifyUpload();">Upload File</a>
</form>
</body>
</html>
On my uploadify.php when i echo $image_temp = $_POST['tmp_name'];
its giving me no results but it gives me correct output for all other fields send via POST.
Hence at the end i stuck & no image file to move toalbum!! Kindly provide guidance.
I am using uploadify.php to insert data in database & moving image from temp to album folder.