Results 1 to 13 of 13

Thread: file upload form
      
   

  1. #1
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

    Default 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

  2. #2
    Join Date
    Oct 2005
    Location
    England, UK
    Posts
    4,193

    Default 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)



  3. #3
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,294

    Default 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

  4. #4
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default 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!


  5. #5
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

    Default 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

  6. #6
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

    Default 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

  7. #7
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default Re: trouble with the file upload form

    Quote 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!


  8. #8
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

  9. #9
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default 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!


  10. #10
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

    Default 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

  11. #11
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default 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!


  12. #12
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,080

    Default 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!


  13. #13
    Join Date
    Oct 2005
    Location
    England
    Posts
    125

    Default 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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