How to upload a file using a form

Collapse
This topic is closed.
X
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • sebastianmuntean
    Private First Class

    • Jul 2006
    • 7

    #61
    Re: How to upload a file using a form

    Maybe VH lowered the limit to 2MB... However, it's very annoying, I'll try to talk with VH guys about that because I cannot teach my client how to use FTP to upload his videos on his website

    Anyway, thanks for your help!
    Sebastian

    Comment

    • deanone1
      Private

      • Jan 2006
      • 2

      #62
      Re: How to upload a file using a form

      Can some help, I tried all this and (the steps to allow visitors upload flies and images) but when I try my upload form and click submit it says this;

      Not Found

      The requested URL /uploadaction.php was not found on this server.
      Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.




      why is this can someone help?

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #63
        Re: How to upload a file using a form

        Did you create the "uploadaction" page and publish it as 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

        • jessyh89
          Sergeant

          • Oct 2007
          • 32

          #64
          Re: How to upload a file using a form

          hi...i know this thread was from a long time ago and i'm hoping i can still get some help... i followed these instructions as best i could, then when i tried to test my form, it came up with a screen saying
          "Parse error: syntax error, unexpected $end in /home/ezioxokc/public_html/members/uploadaction.php on line 156"
          could someone please tell me what this means and what i've done wrong?
          this is gonna sound stupid but was i meant to delete the red writing? is that what i did wrong? or is it because i put it into a password protected directory inside the public_html folder?

          sorry to be such a pain!

          thanks, jess

          P.S. i have tried ABVFP but it doesn't seem to agree with me :( but now i appear to be having the same trouble with this way...
          Last edited by jessyh89; 12-12-2007, 04:52 AM. Reason: more info
          www.sportsterriderssa.com

          Comment

          • navaldesign
            General & Forum Moderator

            • Oct 2005
            • 12080

            #65
            Re: How to upload a file using a form

            ABVFP is far more versatile than this script. And it will also mail you the attached files.

            However, we can't help you with this error, because this depends on your code. You must have missed a closing } somewhere.
            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

            • dritar
              Private

              • Apr 2008
              • 2

              #66
              Re: How to upload a file using a form

              Hello, how can i make the script to filter the file extensions?

              Like i want that possible file types to upload are just .ZIP and .PNG

              Comment

              • dritar
                Private

                • Apr 2008
                • 2

                #67
                Re: How to upload a file using a form

                Can someone help me please? Or can someone suggest me... How to protect the upload from hackers?

                Comment

                • navaldesign
                  General & Forum Moderator

                  • Oct 2005
                  • 12080

                  #68
                  Re: How to upload a file using a form

                  You need to use a code like

                  $upload_Name1 = $_FILES[$file_key]['name'];
                  $upload_Name = $prefix.str_replace(" ", "_", $upload_Name1);
                  $upload_Size = ($_FILES[$file_key]['size']);
                  $upload_Temp = ($_FILES[$file_key]['tmp_name']);
                  $upload_Type = ($_FILES[$file_key]['type']);
                  if($upload_Type != "image/gif" AND $upload_Type != "image/pjpeg" AND $upload_Type != "image/jpeg" AND $upload_Type != "image/png" AND $upload_Type != "image/tiff" AND $upload_Type != "image/bmp"){
                  $error1 = "$file_key file type is '$upload_Type' which is not allowed! \n";
                  // Add here a "include" command to include an error page
                  }
                  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

                  • wesleyvinhvan
                    Sergeant

                    • Mar 2008
                    • 21

                    #69
                    Re: How to upload a file using a form

                    Hello Mr. Naval, can you please tell me what I did wrong here with code for uploading a file to my site. I use the same code that you presented, the only thing I change was the filesize from 1000000 (1mb) to 30000000 (30mb). Here is my problem: the code only takes file the have size from 7-8mb. But when I try to send a file with size 11mb the code did not show the error_page and it sent a blank email to me with a blank subject. And it kick off the thank_page to let the user know that their file was successfully sent. BUT NO FILE WAS UPLOADED. Can you tell me what I did wrong. Thanks.

                    ====+++ uploaded code I used +++====

                    <?php
                    // Receiving variables
                    @$email = addslashes($_POST['email']);
                    @$upload_Name = $_FILES['upload']['name'];
                    @$upload_Size = $_FILES['upload']['size'];
                    @$upload_Temp = $_FILES['upload']['tmp_name'];

                    // Validation for max file size
                    if ($upload_Size>0)
                    {
                    if( $upload_Size > 30000000)
                    {
                    //delete file
                    unlink($upload_Temp);
                    header("Location: error.html");
                    exit;
                    }
                    $uploadFile = "uploads/".$upload_Name ;
                    @move_uploaded_file( $upload_Temp , $uploadFile);
                    chmod($uploadFile, 0644);
                    $upload_URL = "http://www.vietnam4christ.org/uploads/".$upload_Name ;
                    }
                    //Sending Email to form owner
                    $mailto = "wesleyvinhvan@vietnam4christ.org";
                    $mailsubj = "New Song Upload";
                    $mailhead = "From: $email\n";
                    reset ($HTTP_POST_VARS);
                    $mailbody = "File submitted:\n";
                    while (list ($key, $val) = each ($HTTP_POST_VARS))
                    {
                    if ($key!="submit")
                    {
                    $mailbody .= "$key : $val\n";
                    }
                    }
                    $mailbody .= "upload: $upload_URL\n";
                    mail($mailto, $mailsubj, $mailbody, $mailhead);
                    // Autoresponder
                    $mailto = $email;
                    $mailsubj = "Song you Sumbitted";
                    $mailhead = "From: Vietnam4christ.org\n";
                    mail($mailto, $mailsubj, $mailbody, $mailhead);
                    header("Location: thankyou_page.html");
                    ?>

                    Comment

                    • navaldesign
                      General & Forum Moderator

                      • Oct 2005
                      • 12080

                      #70
                      Re: How to upload a file using a form

                      Hi Wesley,
                      First, i don't understand why you use this script. You have installed ABFP if i recall, and ABVFP can handle file uploads easire, automatically, so why do you use a separate script ?
                      Second: with php there are server side limitations to the size of file you can upload. Usually it is set to 8 Mb on VH servers, in some cases to 12 Mb. A file bigger than that will cause ANY upload script to break.

                      It is possible to increase the max file size, using a local php.ini file, for a maximum of 52 Mb which is the limit for php.
                      However, creating a local php.ini file, can be somewhat tricky and it is not advisable that you do it unless you have some php experiense. Or it could mess your account.
                      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

                      • ruimpcc
                        Private

                        • Aug 2008
                        • 2

                        #71
                        Re: How to upload a file using a form

                        Hello i did everything was you explained but i still have an error when i try to upload files could you pls take a look in http://mobilarte-pt.cybercafedalinha.com/uploadform.php
                        maybe i'm doing something wrong i don't know i review all several times and i can't see what is wrong.
                        thank's in advance

                        Comment

                        • navaldesign
                          General & Forum Moderator

                          • Oct 2005
                          • 12080

                          #72
                          Re: How to upload a file using a form

                          Don't use this script, it is an old one. Use he built in form processor, it can upload files.
                          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

                          • ruimpcc
                            Private

                            • Aug 2008
                            • 2

                            #73
                            Re: How to upload a file using a form

                            Thank's Naval for your help is working great.
                            Each day i feel that i made a great choice chosing Blue Voda.
                            Thank You all for your help in the tutorials and forums .

                            www.asuaempresaonline.com

                            Comment

                            • Lordywardy
                              Corporal

                              • Apr 2007
                              • 14

                              #74
                              Re: How to upload a file using a form

                              Dear Naval

                              Re having the facility to upload photo files

                              Have used the file wizard to do a form which comprises of 1 text field and 6 upload files and a submit button.
                              When I test it it seems to upload photos ok, but when I check my mail box the resulting email mentions the text box and submit button but no mention of the upload files and no attached photos.

                              What have I done wrong?

                              Many thanks, Gordon
                              Happy New Year

                              Comment

                              • Lordywardy
                                Corporal

                                • Apr 2007
                                • 14

                                #75
                                Re: How to upload a file using a form

                                It has just dawned on me that the problem might be that I'm using an AOL email address, would that be the case?

                                Comment

                                Working...
                                X