Professional Web Applications Themes

reading the input type=file tag with ie6 in asp - ASP

I wanted to write a simple page to let me choose a directory and then list the files in it. The end goal was to make an easy way to copy all the file names in a directory. I tested with Opera7, Mozilla 1.4 and IE6 -- all on windows XP Pro Here is the code. In all three, when I select a file, the complete path is displayed in the file input box. In Opera, reading the form field gives me the same full path. But in IE and Moz I get only the filename -- none of the ...

  1. #1

    Default reading the input type=file tag with ie6 in asp



    I wanted to write a simple page to let me choose a directory and then list
    the files in it. The end goal was to make an easy way to copy all the
    file names in a directory. I tested with Opera7, Mozilla 1.4 and IE6 -- all
    on windows XP Pro


    Here is the code. In all three, when I select a file, the complete path
    is displayed in the file input box. In Opera, reading the form field gives
    me the same full path. But in IE and Moz I get only the filename -- none of
    the path information.



    Any ideas how to salvage this?



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd"
    <html
    <head<meta http-equiv="Content-Type" content="text/html; cht=UTF-8"
    <titleColumbusWebMakers.com-ListDirectory</title
    <link href="../css/columbuswebmakers.css" type="text/css"
    rel="stylesheet"
    </head
    <body
    <div id="banner"
    <h1<a href= "../index.html"ColumbusWebMakers.com</a</h1
    <pExperienced WebSite design and construction</p
    </div
    <div id="Content"<pThis page lets you display all of the filenames in a
    directory. You can then highlight those names and copy them for use in
    another application. First, select any file in the directory you wish to
    display. Then press submit.
    </p
    <form action="" method="post"
    <input type="file" id ="FileList" name = "FileList"
    <input type="submit"
    </form
    <%
    function ListFiles()
    dim fso, folder, files, f
    dim sFiles, i, strFolderName

    sFiles = ""
    i = Request.Form.Count
    for j = 1 to i
    strLabels = strLabels & request.form.key(j) & ": " &
    Request.Form.item(j)
    & ", "
    next
    Response.write strLabels & vbCRLF

    strFolderName = request.form.item("FileList")
    if (strFolderName < "") then
    set fso=CreateObject("Scripting.FileSystemObject")
    lastSlash = instrrev(strFolderName,"\")
    response.write "<pLooking for files in " & strFolderName & "</p"
    strFolderName = mid(strFolderName, 2, lastSlash - 1)
    response.write "<pLooking for files in " & strFolderName & "</p"
    set folder= fso.getFolder(strFolderName)
    set files = folder.files

    for each f in files
    sFiles = sFiles & f.name & "<br"
    next
    response.write "<p" & sFiles & "</p"
    end if

    ListFiles = sFiles
    end function

    ListFiles

    %</div
    </body
    </html




    --
    Joel Goldstick
    [url]http://www.ColumbusWebMakers.com[/url]


    Joel Goldstick Guest

  2. #2

    Default Re: reading the input type=file tag with ie6 in asp

    1. Where are all your >'s?
    2. You realize that this could only possibly work if you're browsing on the
    webserver itself, yes?
    3. The file input is for uploading a file from the client to the server.

    Ray at home

    "Joel Goldstick" <softwarecolumbus.rr.com> wrote in message
    news:eG76J56gDHA.3636tk2msftngp13.phx.gbl...
    >
    >
    > I wanted to write a simple page to let me choose a directory and then
    list
    > the files in it. The end goal was to make an easy way to copy all the
    > file names in a directory. I tested with Opera7, Mozilla 1.4 and IE6 --
    all
    > on windows XP Pro
    >
    >
    > Here is the code. In all three, when I select a file, the complete path
    > is displayed in the file input box. In Opera, reading the form field
    gives
    > me the same full path. But in IE and Moz I get only the filename -- none
    of
    > the path information.
    >
    >
    >
    > Any ideas how to salvage this?
    >
    >
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd"
    > <html
    > <head<meta http-equiv="Content-Type" content="text/html; cht=UTF-8"
    > <titleColumbusWebMakers.com-ListDirectory</title
    > <link href="../css/columbuswebmakers.css" type="text/css"
    > rel="stylesheet"
    > </head
    > <body
    > <div id="banner"
    > <h1<a href= "../index.html"ColumbusWebMakers.com</a</h1
    > <pExperienced WebSite design and construction</p
    > </div
    > <div id="Content"<pThis page lets you display all of the filenames in a
    > directory. You can then highlight those names and copy them for use in
    > another application. First, select any file in the directory you wish to
    > display. Then press submit.
    > </p
    > <form action="" method="post"
    > <input type="file" id ="FileList" name = "FileList"
    > <input type="submit"
    > </form
    > <%
    > function ListFiles()
    > dim fso, folder, files, f
    > dim sFiles, i, strFolderName
    >
    > sFiles = ""
    > i = Request.Form.Count
    > for j = 1 to i
    > strLabels = strLabels & request.form.key(j) & ": " &
    > Request.Form.item(j)
    > & ", "
    > next
    > Response.write strLabels & vbCRLF
    >
    > strFolderName = request.form.item("FileList")
    > if (strFolderName < "") then
    > set fso=CreateObject("Scripting.FileSystemObject")
    > lastSlash = instrrev(strFolderName,"\")
    > response.write "<pLooking for files in " & strFolderName & "</p"
    > strFolderName = mid(strFolderName, 2, lastSlash - 1)
    > response.write "<pLooking for files in " & strFolderName & "</p"
    > set folder= fso.getFolder(strFolderName)
    > set files = folder.files
    >
    > for each f in files
    > sFiles = sFiles & f.name & "<br"
    > next
    > response.write "<p" & sFiles & "</p"
    > end if
    >
    > ListFiles = sFiles
    > end function
    >
    > ListFiles
    >
    > %</div
    > </body
    > </html
    >
    >
    >
    >
    > --
    > Joel Goldstick
    > [url]http://www.ColumbusWebMakers.com[/url]
    >
    >

    Ray at Guest

Similar Threads

  1. Input type file on asp page
    By GwenP in forum ASP
    Replies: 0
    Last Post: April 29th, 03:24 PM
  2. Question about reading input file
    By IAMPsycho webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: January 27th, 05:44 PM
  3. Replies: 3
    Last Post: October 18th, 06:56 AM
  4. Replies: 2
    Last Post: October 16th, 08:29 AM
  5. input type=file
    By Paul Moffitt in forum ASP
    Replies: 4
    Last Post: August 28th, 06:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139