Help! Access Denied

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • soup_or_power@yahoo.com

    #1

    Help! Access Denied

    The browser shows the alert but causes an error "access denied" and
    fails to set the upload.value to null. Please help!

    for(var i=0; i < fileName.length ;i++) {
    if (fileName.charA t( i) ==' ' || fileName.charAt (i) == '*') {
    document.forms[0].upload.value=' ';
    alert("No spaces/wildcards allowed in file names"
    + f.upload.value) ;

    return;
    }
    }

  • Michael Winter

    #2
    Re: Help! Access Denied

    On 03/05/2005 21:57, soup_or_power@y ahoo.com wrote:
    [color=blue]
    > The browser shows the alert but causes an error "access denied" and
    > fails to set the upload.value to null. Please help![/color]

    You cannot set in HTML, nor alter via a script, the value of a file
    INPUT element. That would potentially allow a malicious author to upload
    any file they wanted from a user's machine.

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • soup_or_power@yahoo.com

      #3
      Re: Help! Access Denied

      Thank you Michael!

      Comment

      • Grant Wagner

        #4
        Re: Help! Access Denied

        <soup_or_power@ yahoo.com> wrote in message
        news:1115153854 .669470.156530@ o13g2000cwo.goo glegroups.com.. .[color=blue]
        > The browser shows the alert but causes an error "access denied" and
        > fails to set the upload.value to null. Please help!
        >
        > for(var i=0; i < fileName.length ;i++) {
        > if (fileName.charA t( i) ==' ' || fileName.charAt (i) == '*') {
        > document.forms[0].upload.value=' ';
        > alert("No spaces/wildcards allowed in file names"
        > + f.upload.value) ;
        >
        > return;
        > }
        > }[/color]

        Not to mention that's a pretty inefficient way to check for spaces or
        wildcards. Let String#indexOf( ) do the work for you.

        if (fileName.index Of(' ') != -1 || fileName.indexO f('*') != -1)
        {
        // fileName contains a space or *
        }

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


        Comment

        Working...