Click here to Skip to main content
15,913,722 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: SMS throw Web Service Pin
isroavi25-Apr-06 22:02
isroavi25-Apr-06 22:02 
GeneralRe: SMS throw Web Service Pin
enjoycrack25-Apr-06 22:49
enjoycrack25-Apr-06 22:49 
GeneralRe: SMS throw Web Service Pin
isroavi25-Apr-06 23:26
isroavi25-Apr-06 23:26 
Questionvalidate a file before upload Pin
fmardani25-Apr-06 21:34
fmardani25-Apr-06 21:34 
AnswerRe: validate a file before upload Pin
CWIZO25-Apr-06 21:42
CWIZO25-Apr-06 21:42 
GeneralRe: validate a file before upload Pin
fmardani25-Apr-06 22:01
fmardani25-Apr-06 22:01 
GeneralRe: validate a file before upload Pin
CWIZO25-Apr-06 22:01
CWIZO25-Apr-06 22:01 
GeneralRe: validate a file before upload Pin
NeverHeardOfMe25-Apr-06 22:25
NeverHeardOfMe25-Apr-06 22:25 
Well... you can use Javascript to at least check the file extension - this doesn't guarantee the file is valid, of course, but it will help eliminate some innocent errors....

If you have a file input box on your form

<input id="file1" type="file" onchange="checkFile(this)" name="file1">

You can use the following function - change the line

var fileTypes=["gif","jpg","jpeg"];

to suit whatever file extensions you want to check for.

function checkFile(what){
var source=what.value;
var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
// valid file types
var fileTypes=["gif","jpg","jpeg"];
for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
if (i==fileTypes.length) {
alert("THAT IS NOT A VALID FILE\nYou can only uload files with the following extensions:\n\n"+fileTypes.join(", "));
}
}
// -->
</script>

This script was adapted from one I downloaded from
The JavaScript Source!! http://javascript.internet.com
and the original was created by Abraham Joffe : http://www.abrahamjoffe.com.au/

They would probably appreciate your adding such comments to this script if you use it on a web-page.

cheers
Phil





-- modified at 4:26 Wednesday 26th April, 2006
AnswerRe: validate a file before upload Pin
enjoycrack25-Apr-06 22:53
enjoycrack25-Apr-06 22:53 
GeneralRe: validate a file before upload Pin
fmardani25-Apr-06 23:16
fmardani25-Apr-06 23:16 
Questionto print or save datagrid control in asp.net 1.1 Pin
rajinder s25-Apr-06 21:33
rajinder s25-Apr-06 21:33 
AnswerRe: to print or save datagrid control in asp.net 1.1 Pin
Praveen_S26-Apr-06 1:51
Praveen_S26-Apr-06 1:51 
QuestionComponentArt give me componentart_webui_client/2006_1_1208/A573G988.js not found Pin
sasire1825-Apr-06 21:31
sasire1825-Apr-06 21:31 
AnswerRe: ComponentArt give me componentart_webui_client/2006_1_1208/A573G988.js not found Pin
minhpc_bk26-Apr-06 0:05
minhpc_bk26-Apr-06 0:05 
QuestionControl '_ctl0__ctl2_lbl1' of type 'TextBox' must be placed inside a form tag with runat=server. Pin
MissionSuccess25-Apr-06 21:30
MissionSuccess25-Apr-06 21:30 
AnswerRe: Control '_ctl0__ctl2_lbl1' of type 'TextBox' must be placed inside a form tag with runat=server. Pin
minhpc_bk25-Apr-06 22:44
minhpc_bk25-Apr-06 22:44 
QuestionGoogle Web Service returned and open a new page? Pin
nets070625-Apr-06 20:48
nets070625-Apr-06 20:48 
AnswerRe: Google Web Service returned and open a new page? Pin
minhpc_bk26-Apr-06 0:01
minhpc_bk26-Apr-06 0:01 
QuestionRe: Google Web Service returned and open a new page? Pin
TheEagle28-Jun-06 17:49
TheEagle28-Jun-06 17:49 
Questiondifference between configSource and file attributes in web.config Pin
chakkara200325-Apr-06 19:34
chakkara200325-Apr-06 19:34 
AnswerRe: difference between configSource and file attributes in web.config Pin
minhpc_bk25-Apr-06 23:58
minhpc_bk25-Apr-06 23:58 
GeneralRe: difference between configSource and file attributes in web.config Pin
chakkara200326-Apr-06 3:08
chakkara200326-Apr-06 3:08 
QuestionASP.net Ajax Pin
NICE TO MEET25-Apr-06 17:30
NICE TO MEET25-Apr-06 17:30 
AnswerRe: ASP.net Ajax Pin
CWIZO25-Apr-06 21:44
CWIZO25-Apr-06 21:44 
Questiondebug vs 2003 javascript Pin
raquidd2225-Apr-06 17:27
raquidd2225-Apr-06 17:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.