Jump to content

TonBR

Members
  • Posts

    2
  • Joined

  • Last visited

TonBR's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Please whithout VBScript/ActiveX... I want to use other browsers, not IE only .... interop. <html> <head> <title>file upload sample</title> </head> <script language="javascript" > function validateFile() { var fileName = document.form.file1.value; var extension = ( fileName != "" ? fileName.substring(fileName.length-4).toLowerCase() : "" ); var msg = ""; if ( extension != ".txt") msg = "The file selected " + "(" + fileName + ")\n" + "isn't a valid text file.\n" + "Select a text(*.txt) file"; else msg = "this is a valid txt file."; document.getElementById("msg").innerHTML = msg; } </script> <body> <form name="form"> <input type=file name="file1" accept="text/*" value="*.txt" onkeyup='validateFile();' onmouseout='validateFile();' /> </form> <pre id="msg" > </pre> </body></html> anyway it's a good idea... thank you... but the best is set the filter of open window.have anybody another think ??Thank all.TonBRif ( talent < detach ) return effort^2;
  2. Hi all,This is my first post in this forum.. I need to set a filter for files with .txt extension and validate if those file is a text file... I'm using JSP...I thing can use a servlet to validate if this file is a text valid file... but this isn't my problem at this moment...my problem is in the filter of browse window... searching the web, I found the accept parametter of input type file... but it is for MIME types not for file extension...It's possible in anyway ?tks for any help.TonBRif ( talent < detach ) return effort^2;
×
×
  • Create New...