Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <title>Secure file upload PHP Web Applications</title>
- <head>
- <script language=javascript>
- function chkFileExtension()
- {
- var str=document.upload.userfile.value;
- var ext=str.substring(str.length,str.length-3);
- if ( ext != "gif")
- {
- alert("File is invalid");
- return false;
- }
- else
- {
- return true;
- };
- }
- </script>
- </head>
- <body>
- <form name="upload" action="upload1.php" method="POST" ENCTYPE="multipart/form-data" onSubmit="return chkFileExtension()">
- Select the file to upload: <input type="file" name="userfile">
- <input type="submit" name="upload" value="upload">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement