upload problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • GoldDraco13
    Sergeant Major

    • Jun 2005
    • 92

    upload problem

    I made a form and had it working without error's till I added a upload option and tried to set up my action.php to work with it.


    My Web Site Form Address



    My Error when I submit form with upload selected
    Code:
    ?> 
    [B]Warning[/B]: chmod() [[URL="http://www.prairiefireservices.com/function.chmod"][COLOR=#810081]function.chmod[/COLOR][/URL]]: No such file or directory in [B]/home/dragons/public_html/prairiefireservices/uploadaction.php[/B] on line [B]53[/B]
     
    [B]Warning[/B]: Cannot modify header information - headers already sent by (output started at /home/dragons/public_html/prairiefireservices/uploadaction.php:9) in [B]/home/dragons/public_html/prairiefireservices/uploadaction.php[/B] on line [B]74[/B]
    ?>

    My uploadaction.php
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Thank You</title>
    <meta name="AUTHOR" content="GoldDraco13">
    <meta name="KEYWORDS" content="fireplace, gas, wood, service, install, house, build">
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=1)">
    <meta name="GENERATOR" content="Created by BlueVoda">
    <style type="text/css">
    div#container
    {
       width: 800px;
       position: relative;
       margin-top: 0px;
       margin-left: auto;
       margin-right: auto;
       text-align: left;
    }
    body
    {
       text-align: center;
       margin: 0;
    }
    </style>
    ?> 
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <?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 >100000000)
    {
    //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 = "<A href="http://www.dragonsofpern3.com/uploads/".$upload_Name">http://www.dragonsofpern3.com/uploads/".$upload_Name ;
    }
    //Sending Email to form owner
    $mailto = "[EMAIL="dragons@dragonsofpern3.com"]dragons@dragonsofpern3.com[/EMAIL]";
    $mailsubj = "PF Install Form";
    $mailhead = "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody = "Job Specs :\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);
    header("Location: thankyou_page.html");
    ?>
    ?> 
    <div id="container">
    <div id="bv_" style="position:absolute;left:0px;top:97px;width:800px;height:6px;z-index:0" align="left">
    <img src="bv01019.gif" id="Shape1" align="top" alt="" border="0" width="800" height="6"></div>
    <div id="bv_" style="position:absolute;left:6px;top:6px;width:790px;height:76px;z-index:1" align="center">
    <font style="font-size:32px" color="#8B0000" face="Georgia"><b><i>Prairie Fire Services<br>
    Conformation</i></b></font></div>
    <img src="PF_logo.JPG" id="Image1" alt="" align="top" border="0" width="51" height="85" style="position:absolute;left:6px;top:6px;width:51px;height:85px;z-index:2">
    <img src="PF_logo.JPG" id="Image2" alt="" align="top" border="0" width="51" height="85" style="position:absolute;left:743px;top:6px;width:51px;height:85px;z-index:3">
    <div id="bv_" style="position:absolute;left:0px;top:208px;width:794px;height:280px;z-index:4" align="center">
    <font style="font-size:48px" color="#8B0000" face="Georgia"><b><i>Thank you<br>
    for choosing<br>
    Prairie Fire Services<br>
    for your<br>
    fireplace needs</i></b></font></div>
    <a href="[URL]http://www.prairiefireservices.com[/URL]" target="_self"><img src="home.bmp" id="Image3" alt="" align="top" border="2" width="44" height="41" style="position:absolute;left:376px;top:524px;width:48px;height:45px;z-index:5"></a>
    </div>
    </body>
    </html>

    Thanks for any help to resolve this issue.


    GD13,
    =]
  • Andy128
    Major General

    • Dec 2005
    • 2317

    #2
    Re: upload problem

    GD13-

    This is supposed to go into notepad- not into a webpage.

    Second- i have changed the code and the "Upload Url " Line was in error.

    Also-- you have not created an error.html page to go with this script.

    PHP Code:
    <?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 >100000000)
    {
    //delete file
    unlink($upload_Temp);
    header("Location: error.html");
    exit;
    }
    $uploadFile "uploads/".$upload_Name ;
    @
    move_uploaded_file$upload_Temp $uploadFile);
    chmod($uploadFile0644);
    $upload_URL "http://www.dragonsofpern3.com/uploads/".$upload_Name;
    }
    //Sending Email to form owner
    $mailto "dragons@dragonsofpern3.com";
    $mailsubj "PF Install Form";
    $mailhead "From: $email\n";
    reset ($HTTP_POST_VARS);
    $mailbody "Job Specs :\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);
    header("Location: thankyou_page.html");
    ?>
    First- go back and read through the tutorial and see if you covered everything. Make the changes and then test.

    Andy
    PHP- is a blast!

    Comment

    • GoldDraco13
      Sergeant Major

      • Jun 2005
      • 92

      #3
      Re: upload problem

      I went and made a seperate uploadaction.php on a notepad and uploaded it to the site, I also made a thankyou_page and error_page and made a folder in my main directory "uploads", I directed the form to the uploadaction.php and I'm still getting the same errors.

      uploadaction.php
      Code:
      <?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 >100000000)
      {
      //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 = "<A href="http://www.dragonsofpern3.com/uploads/".$upload_Name">http://www.dragonsofpern3.com/uploads/".$upload_Name;
      }
      //Sending Email to form owner
      $mailto = "[EMAIL="dragons@dragonsofpern3.com"]dragons@dragonsofpern3.com[/EMAIL]";
      $mailsubj = "PF Install Form";
      $mailhead = "From: $email\n";
      reset ($HTTP_POST_VARS);
      $mailbody = "Job Specs :\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);
      header("Location: thankyou_page.html");
      ?>
      Error Message

      Warning: chmod() [function.chmod]: No such file or directory in /home/dragons/public_html/prairiefireservices/uploadaction.php on line 20

      Warning: Cannot modify header information - headers already sent by (output started at /home/dragons/public_html/prairiefireservices/uploadaction.php:20) in /home/dragons/public_html/prairiefireservices/uploadaction.php on line 38


      Form Address

      http://www.prairiefireservices.com/installation.html


      Questions:

      1. Do you upload the error and thankyou page to the same directory as the uploadaction.php ? I only ask cause it seems the error is saying it can't find them.

      2. I'm working this form from a sub domain name so its in a sub folder of the main folder, would the uploadaction.php in a sub folder be effected? Just asking to see if my situation is making this more difficult.

      Thanks for any help given, I've loved this service since day 1 and even with the few problems I get I'm happy to have found BV.


      GD13,

      Comment

      • Andy128
        Major General

        • Dec 2005
        • 2317

        #4
        Re: upload problem

        Yes- all the files must be in the same directory. Give that a try.

        Your form does submit if no fields are filled in- so at least the form is submitting to the uploadaction.php


        Andy
        PHP- is a blast!

        Comment

        • navaldesign
          General & Forum Moderator

          • Oct 2005
          • 12080

          #5
          Re: upload problem

          1st: you can't upload a 100 Mb file using a php script. Even changing the .ini file setings by using a local php.ini file, you can get up to 52 Mb.

          2nd, why don't you simply install ABVFP? It will handle easily all your uploads and will also email you the files.

          3rd: create a folder called "uploads" in the same folder where the script is, and change its permissions to 777 before trying the script.

          4th: you have no link in your email body that will let you know that a file has been uploaded, nor the link to the file itself. You will have to check, everytime you recieve a submission, to see if a new file has been uploaded. Not very easy when you have 30 - 50 or more files in your "uploads" folder.
          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

          • GoldDraco13
            Sergeant Major

            • Jun 2005
            • 92

            #6
            Re: upload problem

            Thanks alot for all your help, all the advice has been extremly helpful, I have it working and am on my way to a get working web site. www.prairiefireservices.com check it out, let me know what you think.


            GD13,
            =]

            Comment

            Working...
            X