Announcement

Collapse
No announcement yet.

file upload form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • file upload form

    Hi,

    I am working on a site for a client and we need to allow people to upload a couple of files from a form. I have copied the script and instuctions on how to upload multiple files and adapted it, but obviously have gone wrong somewhere as am receiving this error message when I hit the "Submit" button on the form:

    Parse error: syntax error, unexpected $end in /home/jioioipz/public_html/choicesescorts/uploadaction.php on line 84

    The steps I have taken are as follows:

    Copied the script to notepad, adapted it and published it to site as upload action.php

    Created an error page, thank you page, created a new file called uploads and set permissions to 777 and obviously the form. These are titles as follows:

    www.choicesescorts.co.uk/thank_you.html
    www.choicesescorts.co.uk/error_page.html
    www.choicesescorts.co.uk/uploads
    www.choicesescorts.co.uk/recruitment.html


    The script has been copiedabnd adapted as follows:

    <?php
    // Receiving variables
    @$email = addslashes($_POST['email']);
    @$upload_Name = $_FILES['upload']['name'];
    @$upload_Size = $_FILES['upload']['size'];
    @$upload_Temp = $_FILES['upload']['tmp_name'];
    @$upload1_Name = $_FILES['upload1']['name'];
    @$upload1_Size = $_FILES['upload1']['size'];
    @$upload1_Temp = $_FILES['upload1']['tmp_name'];
    // Validation for max file size
    // Validation for the first file, if it exists. Repeat the block as many times as your upload fields.
    if ($upload_Size>0)
    {
    if( $upload_Size >1000000)
    {
    //delete file
    unlink($upload_Temp);
    header("Location: error.html");
    exit;
    }
    }
    // Validation for the second file, if it exists. In the additional blocks, change the number 1 to 2 or 3 or ... n
    if ($upload1_Size>0)
    {
    if( $upload1_Size >1000000)
    {
    //delete file
    unlink($upload1_Temp);
    header("Location: error.html");
    exit;
    }
    }
    // Uploading the first file, if it exists. Repeat as many times as your upload fields.
    if ($upload_Size>0)
    {
    $uploadFile = "uploads/".$upload_Name ;
    @move_uploaded_file( $upload_Temp , $uploadFile);
    chmod($uploadFile, 0644);
    $upload_URL = "<A href="http://www.choicesescorts.co.uk/uploads/".$upload_Name">http://www.choicesescorts.co.uk/uploads/".$upload_Name ;
    // Uploading the second file, if it exists.
    if ($upload1_Size>0)
    {
    $uploadFile = "uploads/".$upload1_Name ;
    @move_uploaded_file( $upload1_Temp , $uploadFile);
    chmod($uploadFile, 0644);
    $upload1_URL = "<A href="http://www.choicesescorts.co.uk/uploads/".$upload1_Name">http://www.choicesescorts.co.uk/uploads/".$upload1_Name ; // You must change the number 1 to 2 or 3 or whatever in the additional blocks
    }
    //Sending Email to form owner
    $mailto = "enquiries@choicesescorts.co.uk";
    $mailsubj = "choices job application";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "job application form :\n";
    while (list ($key, $val) = each ($HTTP_POST_VARS))
    {
    if ($key!="submit")
    {
    $mailbody .= "$key : $val\n";
    }
    }
    $mailbody .= "File Link 1: $upload_URL\n"; // This line is to add the link to the first file. Repeat as many times as your upload fields
    $mailbody .= "File Link 2: $upload1_URL\n"; // This line is to add the link to the second file.
    $mailbody .= "If any link is broken, please copy and paste it in your browser's address bar\n";
    mail($mailto, $mailsubj, $mailbody, $mailhead);


    header("Location: thankyou_page.html");
    ?>

    Please could Naval or somone have a quick look at what I have done and see if the mistakes I have made are obvious.

    The purpose of the form is to receive the requested information to our email as well as the two uploaded files. Will it be possible using this script to have the files also sent to be viewed with the email, or if several forms are sent to us by different people how will we know which files come from which person if viewed online in the uploads file.

    Many thanks in advance.

    Rob
    www.saulfarm.com
    www.pumfrett.com
    www.dampguard.com
    www.zakoapartments.com

  • #2
    Re: trouble with the file upload form

    Hi, Rob.

    Maybe Naval will be able to help you, but have you considered using the ABVFP v2? I have recently built a file upload page using this and it works perfectly and forwards the uploaded images along with the email. It was very easy to use and if you already have your form built it would be a breeze for you. It also has built in validation. Just a thought. You can find information about it in the first post of this thread.

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    02036089024 / United Kingdom
    291916438 / Australia

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)


    Comment


    • #3
      Re: trouble with the file upload form

      Hi Rob, I remember a similar post from you sometime last year, so take Amandas advice and download NavalDesign&#180;s new superdooper program.
      that will do the joband more...........

      have fun
      Have fun
      Regards..... David

      Step by Step Visual Tutorials for the complete beginner
      Newbies / Beginners Forum
      FREE Membership Login Scripts: - Meta Tags Analyzer
      My Social Networking Site - Free Contact Forms
      Finished your New website!! Now get it noticed Here:

      Comment


      • #4
        Re: trouble with the file upload form

        ABVFP v2.0 will do all of the tasks you need. It will upload the files, it will also send them as attachments to the email, and it also has security measures built in and field validation. Download it from here. Installation has become a joy, thanks to the installation wizard. It will also store the info in a database table that it will automatically create. A word file with step by step instructions is also included.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment


        • #5
          Re: trouble with the file upload form

          Thanks Naval, David and Girl on the Hill,

          Shall go to the link straight away,

          As always BV the best,

          Rob
          www.saulfarm.com
          www.pumfrett.com
          www.dampguard.com
          www.zakoapartments.com

          Comment


          • #6
            Re: trouble with the file upload form

            Hi Naval,

            Have downloaded and installed ABVFP v2.0

            Looks very good and I proceeded to format the existing form I had, having gone through the tutorial.

            The page with the form on is www.choicesescorts.co.uk/recruitment.html when I submit you just get a 404 page so something isn't reading accross right.

            Have set the Formid and matched the value etc.

            Thanks,

            Rob
            www.saulfarm.com
            www.pumfrett.com
            www.dampguard.com
            www.zakoapartments.com

            Comment


            • #7
              Re: trouble with the file upload form

              Originally posted by Rob
              Hi Naval,

              Have downloaded and installed ABVFP v2.0

              Looks very good and I proceeded to format the existing form I had, having gone through the tutorial.

              The page with the form on is www.choicesescorts.co.uk/recruitment.html when I submit you just get a 404 page so something isn't reading accross right.

              Have set the Formid and matched the value etc.

              Thanks,

              Rob
              You must set the action to be http://www.choicesescorts.co.uk/ABVFP/dbts_abvfp.php
              Navaldesign
              Logger Lite: Low Cost, Customizable, multifeatured Login script
              Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
              DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
              Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

              Comment


              • #8
                Re: trouble with the file upload form

                action was set to:

                http://www.choicesescorts.co.uk/ABVFP/dbts_abvfp.php

                ?
                www.saulfarm.com
                www.pumfrett.com
                www.dampguard.com
                www.zakoapartments.com

                Comment


                • #9
                  Re: trouble with the file upload form

                  No, your form action was set to http://www.choicesescorts.co.uk/dbts_abvfp.php

                  I checked it, and it still is
                  Navaldesign
                  Logger Lite: Low Cost, Customizable, multifeatured Login script
                  Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                  DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                  Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                  Comment


                  • #10
                    Re: trouble with the file upload form

                    Hi Naval,

                    been back to the form and changed the action again to the above. When I click submit, still the 404 error page and the URL is now http://www.choicesescorts.co.uk/ABVFP/dbts_abvfp.php

                    Does the action need to be changed anywhere else other than the form properties.

                    Rob
                    www.saulfarm.com
                    www.pumfrett.com
                    www.dampguard.com
                    www.zakoapartments.com

                    Comment


                    • #11
                      Re: trouble with the file upload form

                      No, only check the file permissions. If you wish, send me your loggin details (IP, user, pass) , i'll have a look
                      Navaldesign
                      Logger Lite: Low Cost, Customizable, multifeatured Login script
                      Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                      DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                      Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                      Comment


                      • #12
                        Re: trouble with the file upload form

                        Ok, fixed it. You had a blank space after "Formid " and at the end of your form action. I edited it on the server. Please edit your form also on your computer.
                        Navaldesign
                        Logger Lite: Low Cost, Customizable, multifeatured Login script
                        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
                        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
                        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

                        Comment


                        • #13
                          Re: file upload form

                          Thanks again Naval, Would never have thought of the problem being the spacing after Formid.

                          BV is definately the best by a distance,

                          Rob
                          www.saulfarm.com
                          www.pumfrett.com
                          www.dampguard.com
                          www.zakoapartments.com

                          Comment

                          Working...
                          X