Currently I have a link NEW IMAGE with the following code.
<a class="cmpn_image" href="javascript:void(0);" id="new_page_image">NEW IMAGE</a>
/* Associated function */
$("#new_page_image").click(function() {
imgType = 'NPG';
$("#uptext_new_page").trigger('click');
});
On clicking the link, it will open the file upload window.
Now what I need is to trigger the same file input on the page load if a value is present in the url. Below shown is my code:
<script>
$(document).ready(function()
{
var param=getparamvalue('p'); // function for getting url paramater
if(param=='new')
{ // upto this is working fine
$("#uptext_new_page").trigger('change'); // not working; here if the paramter is present the file upload window should come triggering the file input
}
});
</script>
<div style="visibility:hidden;">
<form method="post">
<input type="file" name="name" id="uptext" onChange="ajaxUpload(this.form,'imageUpload.php?filename=name&maxSize=9999999999&maxW=1000&relPath=uploads/images/&colorR=255&colorG=255&colorB=255&maxH=400','uploadProgress','<br /><img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' />','<img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /> Error in Upload.'); return false;" />
</form>
<form method="post">
<input type="file" name="name" id="uptext_new_page" onChange="ajaxUpload(this.form,'imageUpload.php?filename=name&maxSize=9999999999&maxW=1000&relPath=uploads/reference/&colorR=255&colorG=255&colorB=255&maxH=400','uploadProgress','<br /><img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' />','<img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /> Error in Upload.'); return false;" />
</form>
</div>
On page load itself, if the parameter p
have value as new
, then the file upload box should be shown. But it is not working.
I also tried with
$("#uptext_new_page").change();
Can anyone help me to fix this?
Thanks in advance.