Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Choose file won't work on submit form... Please Help

    Hi,

    I put a java script in a form which allows the user to choose a file to send with the rest of the form answers. JUST LIKE THE ONE IN THE "POST NEW THREAD" PAGE ON THIS SITE. This is the script below. It browses for the file and it also lets the user view the file too, but I do not receive it in the email with the rest of the info. Should this be a CGI script I am looking for instead of a java script to let the user browse and also submit? Or, maybe it's the wrong script. If not, I can post the rest of the HTML from that page later. Thanks.

    Rich


    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original: Hoop Hooper (hooper119@aol.com) -->
    <!-- Web Site: http://www.angelfire.com/pa3/muddas -->
    <!-- Modified: Larry McClurg (larry@honeybells.com) -->

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    // Thank you Larry McClurg for the cross-browser fix
    function whatFile() {
    window.location= 'file:///' + document.form1.cmuds.value;
    }
    // End -->
    </script>

    </HEAD>

    <BODY>

    <form name=form1>
    <input type=file name="cmuds">
    <input type=button onClick="whatFile()" value="Open File">
    </form>

    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>

    <!-- Script Size: 1.09 KB -->

  • #2
    New Coder
    Join Date
    Jul 2002
    Location
    Portugal
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    frist you have to put in the form tag
    <form enctype="multipart/form-data"
    or else the file input won't upload the file..
    secon you must have a proper server-side code that can
    handle the upload...

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, the script above just navigates to a local file that you browse to...........so it does not require server-side processing.


  •  

    Posting Permissions

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