• All
  • Free Web Hosting
  • Category 2
gravatar

Limmiting File Types to be Uploaded in PHP?


<script type="text/javascript">
function Checkfiles()
{
var fup = document.getElementById('uploaded_file');
var uploaded_file = fup.value;
var ext = uploaded_file.substring(uploaded_file.lastIndexOf('.') + 1);
if(ext == "doc" || ext == "JPG" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "pdf" || ext == "bmp" || ext == "BMP" || ext =="zip" || ext == "rar")
{
return true;
}
else
{
alert("Ooops! the file you are trying to upload is not supported!, Please upload only the supported file format.");
//fup.focus();
//return false;
document.getElementById('uploaded_file').value = "";
}
}
</script>