Topic: Display filenames of completed uploads
Hi
I'm struggling to get the uploaded filenames as they are uploaded from the plupload ui.
Have spent a few hours looking through documentation and examples here but no luck. My code:
init: {
FileUploaded: function(up, file, info) {
$( ".updateimgrow" ).append('filename: ',file);
}
}
(at nearly the end of my script below) shows the "filename:" part but doesnt actually show the file name - just blank.
Any help very much appreciated. I've been looking at the events section and tried several things with no luck.
Thanks
AC
<script type="text/javascript">
var imagesalready = $(".updateimgrow img").length;
// Initialize the widget when the DOM is ready
$(function() {
$("#uploader").plupload({
// General settings
runtimes : 'html5,flash,silverlight,html4',
url : "upload.php?ad_id=<?php echo $ad_id; ?>",
max_file_count: 8 - imagesalready,
// Maximum file size
max_file_size : '20mb',
chunk_size: '1mb',
// Resize images on clientside if we can
resize : {
width : 800,
height : 800,
quality : 70,
crop: true // crop to exact dimensions
},
// Specify what files to browse for
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
],
// Rename files by clicking on their titles
rename: true,
unique_names: true,
// Sort files
sortable: true,
// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
dragdrop: true,
// Views to activate
views: {
list: true,
thumbs: true, // Show thumbs
active: 'thumbs'
},
// Flash settings
flash_swf_url : '/plupload/js/Moxie.swf',
//auto start
autostart: true,
// Silverlight settings
silverlight_xap_url : '/plupload/js/Moxie.xap',
init: {
FileUploaded: function(up, file, info) {
$( ".updateimgrow" ).append('filename: ',file);
}
}
});
// Handle the case when form was submitted before uploading has finished
$('#form').submit(function(e) {
// Files in queue upload them first
if ($('#uploader').plupload('getFiles').length > 0) {
// When all files are uploaded submit form
$('#uploader').on('complete', function() {
$('#form')[0].submit();
});
$('#uploader').plupload('start');
return false; // Keep the form from submitting
}
});
});
</script>