Note that there are some explanatory texts on larger screens.

plurals
  1. POPlupload, dynamically change url
    primarykey
    data
    text
    <p>I have an upload form with plupload and a checkbox with boolean value after the plupload div.</p> <p>I want to change the value of the url in plupload if the checkbox is checked.</p> <p>Here is my code</p> <pre><code>&lt;div id="uploader"&gt; &lt;p&gt;You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.&lt;/p&gt; &lt;/div&gt; &lt;input id="compressFiles" type="checkbox" name="compressFiles" style="margin:10px 0 0 10px;" value="compress" checked="checked" /&gt; $(function() { $("#compressFiles").change(function(){ if( $("#compressFiles").is(':checked') ){ compress = 'compress'; } else{ compress = 'no'; } }) $("#uploader").plupload({ runtimes : 'gears,flash,html5,html4,browserplus,silverlight', url: 'uploadHandler.php?compressFiles=' + compress, max_file_size : '1000mb', max_file_count: 20, // user can add no more then 20 files at a time unique_names : true, dragdrop : true, multiple_queues : true, // Addeb by LG - problem with FF filters: [ {title: "All", extensions: "*"} ], // Rename files by clicking on their titles rename: true, // Sort files sortable: true, // Flash settings flash_swf_url : 'js/plupload.flash.swf', // Silverlight settings silverlight_xap_url : 'js/plupload.silverlight.xap', init : { FilesAdded: function(up) { if( $("#compressFiles").is(':checked') ){ compress = "no" } else{ compress = "no" } } } }); // Client side form validation $('form').submit(function(e) { var uploader = $('#uploader').plupload('getUploader'); // Validate number of uploaded files if (uploader.total.uploaded == 0) { // Files in queue upload them first if (uploader.files.length &gt; 0) { // When all files are uploaded submit form uploader.bind('UploadProgress', function() { if (uploader.total.uploaded == uploader.files.length){ alert("coucou"); $('form').submit();} }); uploader.start(); } else alert('You must at least upload one file.'); e.preventDefault(); } }); }); </code></pre> <p>The value of url variable is defined first time page load with compress value. I tried 1000 thinhs but impossible to refresh the compress value in the url when checkbox change.</p> <p>I hope my problem is clear, dont speak english very good.</p> <p>Thanks for help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload