Problem with an upload form

Discussion in 'HTML' started by bernhard.heinzel@gmail.com, Sep 28, 2006.

  1. Guest

    Hi,

    I got a little problem with an upload form. Everytime I post the form
    it only submits the filename without the path. But I need the path.

    So could anybody help?

    Here is the code:

    <p>New file.</p>
    <form action='script.py' method='post'>
    <table>
    <tr><th>File</th><td>:</td><td><input type='file'
    name='articlefilepath'></td></tr>
    </table>
    <p>
    <input type='hidden' name='task' value='insertfile'>
    <input type='submit' value='Insert Article'>
    <input type='reset' value='Clear'>
    </p>
    </form>
    , Sep 28, 2006
    #1
    1. Advertising

  2. wrote:
    > I got a little problem with an upload form. Everytime I post the form
    > it only submits the filename without the path. But I need the path.


    Stop needing that. Modern browsers won't send it. It would be a security
    hazard.
    Leif K-Brooks, Sep 28, 2006
    #2
    1. Advertising

  3. jojo Guest

    wrote:
    >
    > I got a little problem with an upload form. Everytime I post the form
    > it only submits the filename without the path.


    it does not only send the filename but the whole file...

    > But I need the path.


    what would you do with the path if you could get it? you cannot read
    local files..

    >
    > So could anybody help?
    >
    > Here is the code:
    >
    > <p>New file.</p>
    > <form action='script.py' method='post'>
    > <table>
    > <tr><th>File</th><td>:</td><td><input type='file'
    > name='articlefilepath'></td></tr>
    > </table>


    What's the need of that table? use the <label>-element here:

    <form action='script.py' method='post'>
    <label for='file'>File: </label>
    <input type='file'name='articlefilepath' id='file'>


    > <p>
    > <input type='hidden' name='task' value='insertfile'>
    > <input type='submit' value='Insert Article'>
    > <input type='reset' value='Clear'>
    > </p>
    > </form>
    >
    jojo, Sep 28, 2006
    #3
  4. Scripsit Leif K-Brooks:

    > wrote:
    >> I got a little problem with an upload form. Everytime I post the form
    >> it only submits the filename without the path. But I need the path.

    >
    > Stop needing that. Modern browsers won't send it. It would be a
    > security hazard.


    It's more complicated than that. By the specs, a browser _may_ include the
    filename in the submitted data; the meaning of "filename" is left
    unspecified. And some browsers include the relative filename only (just the
    "name part") whereas some browsers include a path name. Even if you get a
    path name, what would you do with it? For all that you can know, it might
    not be even a syntactically valid path name in the _server's_ file system.

    As usual, asking _why_ the path name would be needed would probably get us
    closer to the _real_ problem.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Sep 28, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,422
    Bruce Barker
    Aug 3, 2005
  2. Heather Fraser
    Replies:
    0
    Views:
    614
    Heather Fraser
    Jul 5, 2004
  3. Matt
    Replies:
    8
    Views:
    141,969
    zeeshanakhter2009
    May 26, 2012
  4. Matt
    Replies:
    1
    Views:
    11,129
    David Dorward
    Oct 12, 2004
  5. Replies:
    1
    Views:
    915
    Gabriel Genellina
    Nov 25, 2006
Loading...

Share This Page