jfeldstein/jQuery.AjaxFileUpload.js

Not sure how to change a param

smashmirrorcardboardface opened this issue · 1 comments

Hi, I'm using your great ajax file upload code like this:
$(document).ready(function(){
$('#fileSelector').ajaxfileupload({
'action': 'UploadFile',
'params':{
'filePath':$('#filePathInput').val()
},
'onComplete': function(response) {
$('#infoDiv').html("File Uploaded").fadeOut(5000);
},
'onStart': function() {
$('#infoDiv').html("Uploading").show();
}
});
});

I want to be able to change the filePath param and use whatever is the value of that input field when the ajaxfileupload function is fired.

with the code as it is at the moment it only uses the value of the input field at page load.

any ideas how to implement what i need??

Here is the HTML oin the page:

<script src="js/jquery/jquery.ajaxfileupload.js"></script>
<script language="Javascript">
var filePath = $('#filePathInput').val();
$(document).ready(function(){
    $('#fileSelector').ajaxfileupload({
       'action': 'UploadFile',
       'params':{
           'filePath':$('#filePathInput').val()
           },
       'onComplete': function(response) {         
         $('#infoDiv').html("File Uploaded").fadeOut(5000);
       },
       'onStart': function() {
         $('#infoDiv').html("Uploading").show();
       }
    });
});

</script>
</head>
<body>
<form>
<div>                                 
 <div id="fileInputDiv" style="font-size:11px; font-family:'Trebuchet MS', Helvetica, sans-serif">Upload New Report Version - <br /><input type="file" id="fileSelector" name="datafile" /></div>   
 <div id="infoDiv" style="font-size:11px; font-family:'Trebuchet MS', Helvetica, sans-serif"></div>
 <input id="filePathInput" />
</div>
</form>