Text file upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krithikav
    New Member
    • Sep 2007
    • 7

    Text file upload

    I have a form with file input as follows.

    <FORM Name="F1" enctype="multip art/form-data" Method="post" Action="sample. asp" target=Frm2>
    Choose File <input type="file" name="file1" size="20">
    </form>

    When I click on Browse button, I would like to see only .txt files, i.e. in "Files of type" it needs to be .txt and not "All files".

    How will I achieve this in ASP?

    Thanks in advance.

    Krithika
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello krithikav,

    Sorry this is not possible with FileUpload control. What has always been suggested is to check the file extension before uploading file to the server.

    Sorry, but that is the best that I have ever came up with~

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Originally posted by CroCrew
      Hello krithikav,

      Sorry this is not possible with FileUpload control. What has always been suggested is to check the file extension before uploading file to the server.

      Sorry, but that is the best that I have ever came up with~
      W3C says the "Accepts" attribute does this, but I was told most current browsers ignore this attribute. Syntax should be: [code=html]<input type="file" accepts="text/html">[/code]

      Comment

      Working...