I am using valums-file-uploader plugin. It allows me to upload files using ajax. I have a problem with it. I have the following script-
<input type="text" id="Gaurav" name="Gaurav" />
<script src="fileuploader.js" type="text/javascript"></script>
<script>
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file'),
action: 'do-nothing.php',
params:{param: document.getElementById('Gaurav').value},
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
minSizeLimit: 1,
debug: false
});
}
// in your app create uploader as soon as the DOM is ready
// dont wait for the window to load
window.onload = createUploader;
</script>
In it, I want to set the value of param entered by the user. The code is working properly for default value of Gaurav, but didn’t work for user inputted value.
You need to call
createUploaderafter the user has entered a value. This code is ‘fixing’ the param value as soon as the window loads.You may have a button click event or something – call it from that and it will take the value at that time…