Topic: input to dynamically set the destination folder
Hello,
I try to set an html input on Plupload to create new destination folder each time it's necessary.
I'm using "multipart_params" to pass my variable to upload.php's file. If variable is static, it works fine, but if variable's dynamic, nothing works.
I have read that some people realize this, but i can't understand how they proceed.
Perhaps someone could help me to understand ?
Here is my code :
HTML
<input name="name" type="text" id="name" value="" />JQUERY
<script type="text/javascript">
function $(id)
{
return document.getElementById(id);
}
var uploader = new plupload.Uploader(
{
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'pickfiles',
container: 'container',
max_file_size : '10mb',
multipart_params :
{
'name1' : '#name'.val()
},
url : 'plupload/examples/upload.php/',
resize : {width : 800, height : 800, quality : 100},
flash_swf_url : 'plupload/js/plupload.flash.swf',
silverlight_xap_url : 'plupload/js/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
});
uploader.bind('Init', function(up, params)
{
$('environ').innerHTML = "<strong> " + params.runtime + "</strong>";
});
uploader.bind('FilesAdded', function(up, files)
{
for (var i in files)
{
$('filelist').innerHTML += '<div id="' + files[i].id + '">' + files[i].name + ' (' + plupload.formatSize(files[i].size) + ') <b></b></div>';
}
});
uploader.bind('UploadProgress', function(up, file)
{
$(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
});
$('uploadfiles').onclick = function()
{
uploader.start();
return false;
};
uploader.init();
</script>Thanks for all