Announcement

Collapse
No announcement yet.

Another Scripting Problem

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

  • 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
    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

    Comment

    Working...
    X