hi all,
I am facing a problem in a form where i have a form element which its type=file, i use it to upload image from local hard drive, but, besides, i also wanna cater another function where user can select from the existing image (from image bank in the server), what it return to the user is the image_id of the selected image. But, i can\'t manage to use the same form element, since the file type that form element is different, select from image bank one need a \'text\' field type while upload from local harddrive one need \'file\' field type. Below is the piece of code that i have:
The form elemnent:
<INPUT NAME=userfile TYPE=file size=32><input type=hidden name=userfileid>
<input type=button value=\\"Select\\" onclick=\\"javascript:showbannerlib(\'banner\',\'userfile\', \'\".$tl.\"\')\\">
And the javascript:
<script language=\\"Javascript\\">\n
<!-- //
function showbannerlib(formname, fieldname, tl) {
msgWindow = open(\'$PHP_SELF?action=list_banner_image&formname=\'+formname+\'&fieldname=\'+fieldname+\'&tl=\'+tl,\'BANNER\',\'width=750,height=450,toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,scrollbars=yes\',\'POPUP\');\n
if (msgWindow.opener == null) msgWindow.opener = self;\n
msgWindow.moveTo(25,25);
}
// -->
</script>
Hope there are some solution for this case. thanks!