File Upload - <input type=file>

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

    #1

    File Upload - <input type=file>

    I'm trying to figure out how to verify that the file trying to be uploaded
    exists. On my page if I type in the name of a file that doesn't exist it
    get's uploaded as a file with 0 bytes.

    When using Yahoo mail when I type in a non-existent file and try to upload
    it will come back and tell me "Invalid File" but I can't figure out how they
    are doing it.

    Help would be appreciated!
    RWK


  • Dietmar Meier

    #2
    Re: File Upload - &lt;input type=file&gt;

    RWK wrote:
    [color=blue]
    > I'm trying to figure out how to verify that the file trying to be
    > uploaded exists. On my page if I type in the name of a file that
    > doesn't exist it get's uploaded as a file with 0 bytes.[/color]

    For security reasons there should be no chance using client side
    JS to check anything in the client's file system.
    [color=blue]
    > When using Yahoo mail when I type in a non-existent file and try to
    > upload it will come back and tell me "Invalid File" but I can't
    > figure out how they are doing it.[/color]

    Maybe they simply reject all empty files. Try to upload an existing
    file with 0 bytes and see if there's a difference to a non-existing
    file. Anyway, they check it on the server, not on the client.

    ciao, dhgm

    Comment

    • RWK

      #3
      Re: File Upload - &lt;input type=file&gt;

      You're awsome dude... I knew about the restrictions with accessing the local
      file system from script so that's why I was stumped as to how Yahoo was
      doing it... checking for 0 bytes on the server... easy enough!

      Thanks!

      "Dietmar Meier" <usereplytoinst ead@innoline-systemtechnik.d e> wrote in
      message news:35sqm1F4r5 nlfU1@individua l.net...[color=blue]
      > RWK wrote:
      >[color=green]
      > > I'm trying to figure out how to verify that the file trying to be
      > > uploaded exists. On my page if I type in the name of a file that
      > > doesn't exist it get's uploaded as a file with 0 bytes.[/color]
      >
      > For security reasons there should be no chance using client side
      > JS to check anything in the client's file system.
      >[color=green]
      > > When using Yahoo mail when I type in a non-existent file and try to
      > > upload it will come back and tell me "Invalid File" but I can't
      > > figure out how they are doing it.[/color]
      >
      > Maybe they simply reject all empty files. Try to upload an existing
      > file with 0 bytes and see if there's a difference to a non-existing
      > file. Anyway, they check it on the server, not on the client.
      >
      > ciao, dhgm[/color]


      Comment

      • Grant Wagner

        #4
        Re: File Upload - &lt;input type=file&gt;

        "RWK" <me@nowhere.com > wrote in message
        news:b49Kd.1098 1$6o1.5450@news svr31.news.prod igy.com...[color=blue]
        > I'm trying to figure out how to verify that the file trying to be
        > uploaded
        > exists. On my page if I type in the name of a file that doesn't exist
        > it
        > get's uploaded as a file with 0 bytes.
        >
        > When using Yahoo mail when I type in a non-existent file and try to
        > upload
        > it will come back and tell me "Invalid File" but I can't figure out
        > how they
        > are doing it.[/color]

        I just ran a small test. It's pretty obvious that when you click Attach
        Files the file is actually uploaded (and most likely tagged with a
        message id so Yahoo! knows which message it "belongs to"). So the server
        is detecting that the file is 0 bytes and complaining.

        This was verified by -touch-ing a file and attempting to attach it, I
        got the same "Invalid File" message.

        In other words, the detection is not happening on the client (nor can it
        in a cross-platform, cross-browser way).

        --
        Grant Wagner <gwagner@agrico reunited.com>
        comp.lang.javas cript FAQ - http://jibbering.com/faq


        Comment

        Working...