Help: file upload control bug

When the user accidentally enters character into the file upload control and saves the document, the document disappear and it’s lost.

How can i control the file upload control to accept only attachments and not input characters? Can you please give me a script that can validate file upload control to accept only file attachments and not input characters.

You’re help is really appreciated.

Subject: help: file upload control bug

Hi Jim,

I am assuming that you are looking JavaScript solution for web application.

Here it is sample snippet for validating upload control…

function Validate()

{

var filename=GetFileName()

var val=GetExtension(filename)

val=val.toUpperCase();

if(val!="XLS")

{

	return alert("The file is not in correct format");

}

document.forms[0].submit();

}

function GetFileName()

{

var f=document.forms[0];

var i;

for(i=0;i<=f.elements.length;i++)

{

if(f.elements[i].type=="file")

{

f.FilePath.value=f.elements[i].value

	return f.elements[i].value;}

}

}

function GetExtension(filename)

{

var sfilename=filename.split(".")

var j=sfilename.length-1

return sfilename[j];

}

Thanks

Sreedhar

Subject: RE: help: file upload control bug

Thank you very much Sreedhar for your response. I think this will help.