Multiple File Upload W/ One <input type=file> control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Axe

    #1

    Multiple File Upload W/ One <input type=file> control

    Here's the problem: I've got an ASP.NET (C#) web page that has a single
    <input type=file> control on it for uploading a file. The way the code
    works is that the uploaded file is then parsed for the path and file name.
    I then save the posted file to a temporary directory on the web server (for
    later processing). I then open up a file stream and stream reader and read
    a related file into a string that is in the posted file's same directory
    (and has the same filename; just a different file type).

    This works great and wonderful when I test it on my development machine and
    my test machine. However, when I test it remotely, the posted file's path
    is relative the user's local machine. When the web server attempts to find
    that related file it fails because it doesn't have the same path as the
    user's local machine.

    Am I confusing anyone as much as I'm confused?

    Bottom line, we can't have two input controls for the upload process. I
    need to get to that second file. How? I know the local path but the web
    server can't deal with that can it?

    Thanks for your help.


  • Mark

    #2
    Re: Multiple File Upload W/ One &lt;input type=file&gt; control

    "Axe" <way@too.much.s pam> wrote in
    news:7DxWa.1286 22$Io.10909211@ newsread2.prod. itd.earthlink.n et:
    [color=blue]
    > Bottom line, we can't have two input controls for the upload process.
    > I need to get to that second file. How? I know the local path but
    > the web server can't deal with that can it?
    >
    > Thanks for your help.[/color]

    You can upload exactly one file per <input type=file> tag. There's no way
    around that. You also can't script those tags (that would be a gaping
    security hole).

    If the client needs to send 2 files to the server, then there will have to
    be 2 <input type=file> tags, and the user will have to type in (or browse
    to) 2 separate filenames.

    Mark

    Comment

    Working...