Upload multi files HELP

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

    • Sep 2006
    • 29

    Upload multi files HELP

    i use the following script for multi files upload via a form

    i use the method propoesed by VodaHost at Mar 2005 (http://www.vodahost.com/vodatalk/for...sing-form.html)

    I modify it for 3 files. i follow all the steps, create the form, the erro page and the thank you page and i get the error:

    "Parse error: syntax error, unexpected $end in /home/adztfwgs/public_html/myhome/uploadaction.php on line 103"

    CAN ANYONE HELP ME ??????

    P.S ( for 1 file works)

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

    <?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'];
    @$upload2_Name = $_FILES['upload2']['name'];
    @$upload2_Size = $_FILES['upload2']['size'];
    @$upload2_Temp = $_FILES['upload2']['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 >500000)
    {
    //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 >500000)
    {
    //delete file
    unlink($upload1_Temp);
    header("Location: error.html");
    exit;
    }
    }
    if ($upload2_Size>0)
    {
    if( $upload2_Size >500000)
    {
    //delete file
    unlink($upload2_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 = "http://www.myhome.net.gr/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 = "http://www.myhome.net.gr/uploads/".$upload1_Name" ;
    }
    if ($upload2_Size>0)
    {
    $uploadFile = "uploads/".$upload2_Name ;
    @move_uploaded_file( $upload2_Temp , $uploadFile);
    chmod($uploadFile, 0644);
    $upload2_URL = "href="http://www.myhome.net.gr/uploads/".$upload2_Name ;
    }
    //Sending Email to form owner
    $mailto = "theodore.k@flyeuroair.eu";
    $mailsubj = "New property POSTED";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Values submitted from web site 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 .= "File Link 3: $upload2_URL\n";
    $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");
    ?>

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

    Thank
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Upload multi files HELP

    You have missed a } Look at your own post, i have added it.

    Maybe there are also other errors, but didn't have the time for a test. Try it and let me know.

    However, if you read the tutorial again, you will see that we are now reccomending ABVFP which will not only do what you want, but it will also validate, give error messages and much more. Have a look at: http://www.vodahost.com/vodatalk/new...html#post78273
    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

    • theodore
      Sergeant

      • Sep 2006
      • 29

      #3
      Re: Upload multi files HELP

      thanks for your quick reply.

      i put th } missing and now gives me that error:

      "Parse error: syntax error, unexpected T_STRING in /home/adztfwgs/public_html/myhome/uploadaction.php on line 52"

      If you could help me i would appreciate it !!!!!

      thanks

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Upload multi files HELP

        Hmmmm. Did you by any case, copy the entire corrected script above ?

        I'm asking because if you did, then you will get an error. You see, this forum editor, automatically purses links, and, in your case, when you posted the code, it has converted the original line 52, which should be :
        $upload_URL = "http://www.myhome.net.gr/uploads/".$upload_Name" ;

        to what it was above. The same also for the other two similar lines. I corrected it in the post, Correct it in your script.

        Also correct the line in GREEN in your post above.Itwas upload1, so the third file would never be uploaded.

        Για οτι θελησεις χρησιμοποιησε τη φορμα μου.
        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

        • theodore
          Sergeant

          • Sep 2006
          • 29

          #5
          Re: Upload multi files HELP

          Thanks i have just found it, test it and works !!! and i was ready to post the correction.

          I have to tell you that i;m impress for your quick and professional answers.

          "pay one's respects" GENERAL

          Theodore.......

          Comment

          • navaldesign
            General & Forum Moderator

            • Oct 2005
            • 12080

            #6
            Re: Upload multi files HELP

            You are very welcome. Whatever you might need, look at the bottom of post #4
            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

            Working...
            X