If You Ever Wanted To Know How You Can Verify Or Check What Type Of File Your Users Are Uploading You Will Find This Short Tutorial Helpful Because Webune Is Going To Show You How To [2206], Last Updated: Mon Jun 24, 2024
Webune Tutorials
Mon Jan 11, 2010
4 Comments
782 Visits
Welcome to Webune Support Forums
Webune provides Excellent service. Are you tired of your current web hosting provider with their poor service? make the switch to Webune. Sign up today with one of our affordable web hosting plans for your websites!
if you ever wanted to know how you can verify or check what type of file your users are uploading you will find this short tutorial helpful because webune is going to show you how to you can check to see what kind of file your users are uploading on your forms.
DEMO:
(only .jpg files allowed)
Select File:
NOTE: try uploading a .jpg file, then try uploading a different type of file to see the validation.
so how did we do this?
if you wish, you can download the file, we have attached it to this post, or if you want to follow the instructiong given in the reply below in the replies section:
check-file-extension.html
Webune Tutorials
Mon Jan 11, 2010
Here is the code, to see it in action, open a blank notepad in windows, copy and paste the code below and save it as: checkfile.html - then open it it with your browser!
checkfile.html
<h1>Check File Extension</h1>
<p>Script Provided by <a href="http://www.webune.com">Webune.com</a></p>
<script type="text/javascript" language="javascript">
// SCRIPT PROVIDED BY WWW.WEBUNE.COM WEB HOSTING
function checkfile(){
var FileExt = document.getElementById('uploadfile').value.lastIndexOf(".jpg")
if(
FileExt==-1) {
alert("This File Is Not Allowed");
return false;
}else{
alert("YES!! - We do allow this file");
return true;
}
}
</script>
<form action="" method="">
Select File: <input type="file" id="uploadfile" name="uploadfile"/>
<input type="button" id="submit" name="submit" value="Upload" onclick="checkfile();"/>
</form>
<p>Find more helpful scripts by Webune at: <a href="http://www.webune.com">www.webune.com</a></p>
<p><a href="http://www.webune.com"><img src="http://www.webune.com/images/headers/default_logo.jpg" border="0" /></a></p>
Thats it
t a g c l o u d: analyze ascertain audit balance account candle case compare confirm correct count enquire about eyeball find out frisk go through investigate keep account look at look over look see make sure monitor note overlook probe prove quiz review scout out scrutinize study take stock tell test try verify
checkfile.html Thats it
t a g c l o u d: analyze ascertain audit balance account candle case compare confirm correct count enquire about eyeball find out frisk go through investigate keep account look at look over look see make sure monitor note overlook probe prove quiz review scout out scrutinize study take stock tell test try verify