Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

I need a simple form with an upload button!

  • 25-08-2012 7:38pm
    #1
    Registered Users, Registered Users 2 Posts: 9,844 ✭✭✭


    Hi all,

    I desperately need a simple form that will give the user an option to upload a file. I know this will probably involve some php and thats fine.

    Basically, all I need is a text box for their Name, one for an email address, text area for a comment, an upload button so they can select a file and send.

    It can either go to a folder on the server or to an email address, whichever is easier.

    Can anybody help??


Comments

  • Registered Users, Registered Users 2 Posts: 9,844 ✭✭✭py2006


    I have the basic html form. When the file is submitted the user can be brought to a page thanking them for the comment and upload?

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    </head>

    <body>


    <form action="" method="get" name="upload form">


    Name: <input name="name" type="text" value="name">
    <br>
    Comment:<textarea name="comment" cols="" rows=""></textarea><br>

    Upload your file<input name="upload" type="file" size="10"></select><br>
    <br>

    <input name="Submit" value="Submit" type="button">

    </form>
    </body>
    </html>


  • Registered Users, Registered Users 2 Posts: 1,757 ✭✭✭Deliverance XXV


    Excellent info here: http://www.w3schools.com/php/php_file_upload.asp.
    Well worth trying out the code yourself as you will learn it much quicker.

    Don't forget to add the enctype to your form's HTML as it will not process the file otherwise.
    [PHP]
    <form action="upload_file.php" method="post" enctype="multipart/form-data">
    <!-- Code -->
    </form>[/PHP]


  • Registered Users, Registered Users 2 Posts: 1,757 ✭✭✭Deliverance XXV


    py2006 wrote: »
    I have the basic html form. When the file is submitted the user can be brought to a page thanking them for the comment and upload?

    At the end of your PHP upload script you can add something like this and it will redirect the user once the script has been processed.

    [PHP]<?php

    //Your code
    header('Location: thank-you.php');

    ?>[/PHP]


Advertisement