Home  >  Article  >  Web Front-end  >  js determines the uploaded file type and determines the FileUpload file type code_javascript skills

js determines the uploaded file type and determines the FileUpload file type code_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:47:361334browse

HTML tag code in asp.net:

Copy code The code is as follows:




Common html tags:
Copy code The code is as follows:




For ASP.NET or ordinary HTML tags, the following JS code is applicable:
Copy code Code As follows:

function CheckWorkFile()
{
var obj=document.getElementById('fuMain');
if(obj.value=='')
{
alert('Please select the assignment book file to upload');
return false;
}
var stuff=obj.value.match(/^(.*)(.)( .{1,8})$/)[3];
if(stuff!='doc')
{
alert('The file type is incorrect, please select the .doc file');
return false;
}
return true;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn