Results 1 to 2 of 2

Thread: Another Scripting Problem
      
   

  1. #1
    Stream Me is offline Private First Class
    Join Date
    May 2007
    Posts
    6

    Default Another Scripting Problem

    Apparently im no good at scripting, i have 2 problems with this one and once again any help would be appreciated:

    Im making an upload box so folks can upload there own mp3's to the site, i followed the text tutorial and again copy and pasted the script i had taken from the help page i now get this:

    http://www.stream-memobile.com/uploadaction.php

    I saved this script as php script in a wordpad file, the script looks like this:

    <?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 = "http://www.stream-memobile.com/uploads/".$upload_Name ;
    }

    //Sending Email to form owner

    $mailto = "nicholasmdobbs********.com";
    $mailsubj = "music";
    $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 .= "upload: $upload_URL\n";
    mail($mailto, $mailsubj, $mailbody, $mailhead);

    header("Location: thankyou_page.html");

    ?>
    Sorry for being a challenge i appreciate all the help,

    Thanks,

    Nick

  2. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: Another Scripting Problem

    Are you sure that is the complete script, line 3 is a comment, I don't see how your are getting those errors from a comment.

    Also there are a few other things that I have seen wrong:

    I went to your website, and the form you use to activate the script isn't correct. You have a text field, a submit button that says "browse" and another submit button that says "submit". The text field and browse button should be changed to a "file" form element.

    Also based on the script you are expecting to have an email submitted but you don't have a field for an email on your form.

    lastly you don't need these lines...

    //delete file
    unlink($upload_Temp);

    PHP automatically deletes temporary files that are not used once the script has finished executing.

    There are some other aspects of the script that arn't neccessary/poor coding, but they shouldn't cause problems.

    As to possible ways to fix:

    Try fixing the form and seeing if the errors are still there when you submit it (the script doesn't give any errors unless you have data submitted to it by a form).

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49