BHUSHANGEETE
asked on
file Upload issue with Special characters
Hi, I am trying to upload the files in JSP. I am getting errros when the file name/folder name has special characters like &,'. Could you please help me out how to do the urlencode and decode the same.
Here is snippet of my code.
<form name="FORM_A" method="POST" ENCTYPE="multipart/form-da ta">
<input name="fileName" size="50" type="file"> <a onClick="javascript:valida tion(this) "><img src="../images/buttons/btn _attach.gi f" name="attach" width="61" height="15" border="0" alt="Attach"></a>
</form>
<script language ="javascript">
function validation(f) {
document.FORM_A.action = "submitNominationTeam.jsp? fileName=" + escape(document.FORM_A.fil eName.valu e)document .FORM_A.su bmit();
return;
}
Any help would be appreciated.
Thanks
Here is snippet of my code.
<form name="FORM_A" method="POST" ENCTYPE="multipart/form-da
<input name="fileName" size="50" type="file"> <a
</form>
<script language ="javascript">
function validation(f) {
document.FORM_A.action = "submitNominationTeam.jsp?
return;
}
Any help would be appreciated.
Thanks
Why do you need the file name in query string? You get already the file name as posted field value.
ASKER
I am trying to post to the same page. In this case, I am not getting the posted field value.
Check this:
<form name="FORM_A" method="POST" action="submitNominationTe am.jsp" ENCTYPE="multipart/form-da ta">
<input name="fileName" size="50" type="file">
<input type="submit" name="attach" value="" style="background:url('../ images/but tons/btn_a ttach.gif' ); width:61; height:15; border:0;" alt="Attach">
</form>
<form name="FORM_A" method="POST" action="submitNominationTe
<input name="fileName" size="50" type="file">
<input type="submit" name="attach" value="" style="background:url('../
</form>
ASKER
Hi, I do have couple of text box controls in the same form which are mandatory fields, I need to validate 'em before submitting the form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.