|
-
Mar 5th, 2006, 09:14 AM
#1
Thread Starter
Fanatic Member
how to check file type in a file path
i have create one file input type for upload file......how to check the path in the text field is what i want? i mean like only able to upload jpg file, gif file and so on.....is it need java script?
-
Mar 5th, 2006, 01:37 PM
#2
Re: how to check file type in a file path
You would need to do a server-side validation (such as PHP, ASP, CGI, etc) for that. Even then, it is not straightforward to check the type, although you could just assume the file extension is correct.
-
Mar 6th, 2006, 03:50 AM
#3
Thread Starter
Fanatic Member
Re: how to check file type in a file path
how about this lines code, is it about validate the file type??
Code:
if((document.form1.upload.value.lastIndexOf(\”.jpg\”)==-1) {
alert(\”Please upload only .jpg extention file\”);
return false;
}
-
Mar 6th, 2006, 03:52 AM
#4
Re: how to check file type in a file path
And if I have Javascript disabled? (Which, BTW, I do for most sites).
That's why you need a server-side check. Maybe a JS one too but always a server-side to fall back on.
-
Mar 6th, 2006, 04:08 AM
#5
Thread Starter
Fanatic Member
Re: how to check file type in a file path
ok........i will do server-side validation.!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|