How can I change the value of "type" it seems to be locked in to the global value. I get this error in fire bug "setting a property that has only a getter" for the code the entered below but if i change the onchange = "type..." to onechange = "var type ..." the alerts work. I'm not trying to get the alerts to work though so i'm not even sure if this is the right track I want the uploader address to get the value from the option value. Thanks for ny ideas.
This is using jquery.
Code:<script type="text/javascript"> var type ="global"; $(function(){ $('#swfupload-control').swfupload({ upload_url: "upload-file.php?id=" + <?php echo $id_is; //send upload-file correct id?> + "&type=" + type, file_post_name: 'uploadfile', file_size_limit : "0", file_types : "*.*", file_types_description : "All file types are allowed.", file_upload_limit : 0, flash_url : "js/swfupload/swfupload.swf", button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png', button_width : 114, button_height : 29, button_placeholder : $('#button')[0], debug: false }) .bind('fileQueued', function(event, file){ var listitem='<li id="'+file.id+'" >'+ 'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+ '<div class="progressbar" ><div class="progress" ></div></div>'+ '<p class="status" >Pending</p>'+ '<span class="cancel" > </span>'+ '</li>'; $('#log').append(listitem); $('li#'+file.id+' .cancel').bind('click', function(){ var swfu = $.swfupload.getInstance('#swfupload-control'); swfu.cancelUpload(file.id); $('li#'+file.id).slideUp('fast'); }); // start the upload since it's queued $(this).swfupload('startUpload'); }) .bind('fileQueueError', function(event, file, errorCode, message){ alert('Size of the file '+file.name+' is greater than limit'); }) .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){ $('#queuestatus').text('Files Selected: '+numFilesSelected+' / Queued Files: '+numFilesQueued); }) .bind('uploadStart', function(event, file){ $('#log li#'+file.id).find('p.status').text('Uploading...'); $('#log li#'+file.id).find('span.progressvalue').text('0%'); $('#log li#'+file.id).find('span.cancel').hide(); }) .bind('uploadProgress', function(event, file, bytesLoaded){ //Show Progress var percentage=Math.round((bytesLoaded/file.size)*100); $('#log li#'+file.id).find('div.progress').css('width', percentage+'%'); $('#log li#'+file.id).find('span.progressvalue').text(percentage+'%'); }) .bind('uploadSuccess', function(event, file, serverData){ var item=$('#log li#'+file.id); item.find('div.progress').css('width', '100%'); item.find('span.progressvalue').text('100%'); var pathtofile='<a href="./../../files/ftp_upload/<?php echo $id_is; //link to uploaded file?>/'+file.name+'" target="_blank" >view »</a>'; item.addClass('success').find('p.status').html('Done!!! | '+pathtofile); }) .bind('uploadComplete', function(event, file){ // upload has completed, try the next one in the queue $(this).swfupload('startUpload'); }) }); </script> </head> <body> <form name="example"> <select name="upload_type" onchange="type = document.example.upload_type.options[document.example.upload_type.selectedIndex].value; alert(type);"> <option value="1">text</option> <option value="2">Video</option> <option value="3">comments</option> <option value="4">Other</option> </select> </form>



Reply With Quote

Bookmarks