It looks like you're new here. If you want to get involved, click one of these buttons!
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#fileUpload2\").fileUpload({
'uploader': 'public/js/uploader.swf',
'cancelImg': 'public/img/cancel.png',
'folder': '../public/images/',
'buttonText': 'Wybierz pliki',
//'checkScript': '_scripts/php/check.php',
'script': 'upload.php',
//'scriptData': {'id':'100'},
'multi': true,
'simUploadLimit': 5,
});
});
</script>
<p>
<input name=\"fileUpload2\" id=\"fileUpload2\" type=\"file\" />
<script type=\"text/javascript\">
$(\"#fileUpload2\").fileUploadSettings('scriptData','&id='+100);
</script>
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\">Start Upload</a> | <a href=\"javascript:$('#fileUpload2').fileUploadClearQueue()\">Clear Queue</a></p>
$(\"#fileUpload2\").fileUploadSettings(\"folder\",\"uploads\");
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#fileUpload2\").fileUpload({
'uploader': 'public/js/uploader.swf',
'cancelImg': 'public/img/cancel.png',
'folder': '../public/images/',
'buttonText': 'Wybierz pliki',
//'checkScript': '_scripts/php/check.php',
'script': 'upload.php',
//'scriptData': {'id':'100'},
'multi': true,
'simUploadLimit': 5,
'fileDesc': 'Pliki graficzne *.jpg;*.jpeg;*.gif;*.png',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
//'sizeLimit': 100,
});
$(\"#fileUpload2\").fileUploadSettings(\"folder\",\"uploads\");
});
</script>
TravisN. said:You can't call the fileUploadSettings in that fashion. Please download the sample files in the download section. There are comments with the script files that explain what is happening and how you need to implement it..
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\" onclick=\"$(\"#fileUpload2\").fileUploadSettings('scriptData','&id='+100);\">Start Upload</a>
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\" onclick=\"javascript:$('#fileUpload2').fileUploadSettings('scriptData','&id='+100);\">Start Upload</a>
scriptData: {'id' : 100},
$('#idField').bind('change', function(){
$('#fileUpload2').fileUploadSettings('scriptData','&id='+$(this).val());
});
$('#idField').bind('change', function(){
$('#fileUpload2').fileUploadSettings('scriptData','&id='+$(this).val());
});
<input type=\"hidden\" id=\"nr\" name=\"nr\" value=\"100\">
<script type=\"text/javascript\">
$('#fileUpload2').fileUploadSettings('scriptData','&id='+$(this).val());
</script>
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\">Start Upload</a> | <a href=\"javascript:$('#fileUpload2').fileUploadClearQueue()\">Clear Queue</a></p>
<p>&nbsp;</p>
TravisN. said:First, I am assuming when you are saying "id" you are referring to a variable, not the id of a HTML element.
If it is generated within the page itself then call scriptData like
[code=php]scriptData: {'id' : '<?php echo $yourVariable ?>'},[/code]
If it is passed to the page via parameters you can use $_GET, $_POST or $_REQUEST
[code=php]scriptData: {'id' : '<?php echo $_REQUEST</span>['yourPassedVariable'] ?>'},[/code]
Make sure you encapsulate the php statements in quotes.
TravisN. said:The call to .fileUpload doesn't have to be in the head. You can move the whole function to the body. just enclose it in the usual tags. Does that answer what your trying to achieve?
scriptData: {'id' : 100},
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\" onclick=\"javascript:$('#fileUpload2').fileUploadSettings('scriptData','&id='+'<?php echo $yourVariable ?>');\">Start Upload</a>
<a href=\"javascript:$('#fileUpload2').fileUploadStart();\">Start Upload</a> | <a href=\"javascript:$('#fileUpload2').fileUploadClearQueue()\">Clear Queue</a></p>
<script type=\"text/javascript\">
$('#fileUpload2').ready(function() {
$('#fileUpload2').fileUploadSettings('scriptData','&id='+'<?php echo $yourVariable ?>');
});
</script>
fileUploadSettings:function(settingName, settingValue) {
$(this).each(function() {
var appoId=$(this).attr('id') + 'Uploader';
setTimeout(\"document.getElementById('\"+appoId+\"').updateSettings('\"+settingName+\"','\"+settingValue+\"');\",1000);
});
},
$(document).ready(function() {
$(\"#fileUpload\").fileUpload({
...............
'folder': 'upload',
...............
});
$('#add-gallery').click(function() {
$.getJSON('/ajax/ajax.php', {action: 'new_gal', name: name}, function(data) {
var folder = 'upload/gallery'+data.id;
alert(folder);
$('#fileUpload').fileUploadSettings('folder', folder);
}
});
});
});