Results 1 to 6 of 6

Thread: Upload Song

  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Upload Song

    When i run this script i get the following error:

    Warning: copy(Don Maclean - Bye Bye Miss American Pie.mp3) [function.copy]: failed to open stream: No such file or directory in /home/ourhabbo/public_html/site/housekeeping/add_song.php on line 38
    Could not copy

    The coding is:

    PHP Code:
    <?
    ob_start
    ();
    include(
    "config.php");
    ?>
    <html>
    <head>
    <title>Home</title>
    <link href="housekeeping.css" rel="stylesheet" type="text/css">
    </head>
    <body bgcolor="#ffffff" class='content'>
    <b>Add Song</b><br>
    Please fill in all fields, and then click Add Song to add the song to the database<br><br>
    <?
    if($logged[username] && $logged[username] == $owner1 || $logged[username] == $owner2 || $logged[username] == $siteman){
    switch(
    $_GET[act]){
    default:
    ?>
    <FORM ACTION="?act=add" METHOD="POST" enctype='multipart/form-data'>
    Song Title: <i>[<b>Artist - Title</b>]</i><br><input type="text" name="title"><br><br>

    Song:<br><input name='file' type='file' id='file'><br><br>

    <input type='submit' name='send' value='Submit'>  
    </form>
    <?
    break;
    case 
    'add':
    $title htmlspecialchars($_POST[title]);
    $filename $_FILES['file']['name'];
    if( 
    $filename !="" )
     {  
    if(!
    file_exists("/home/ourhabbo/public_html/site/songs/" $filename)){
      
    $copy copy $filename,  "/home/ourhabbo/public_html/site/songs/" $filename )  or die( "Could not copy" ); 
    if(
    $copy){
    $query mysql_query("INSERT INTO `songs` (id, title, song) VALUES('','$title','$filename')") or die ('Error during the execution of the MySQL query : ' mysql_error()); 
    echo(
    "<meta http-equiv=\"Refresh\" content=\"2; URL=add_song.php\"/>You have succesfully added the song: $title<br><br><b>Please Wait...</b>");
    }
     }else{
    echo(
    "<meta http-equiv=\"Refresh\" content=\"2; URL=add_song.php\"/>The file already exists, and we cannot overwrite it");
    }
      }else{
    echo(
    "<meta http-equiv=\"Refresh\" content=\"2; URL=add_song.php\"/>You did not select a file to upload");
    }

    break;
    }
    }
    ?>
    </body>
    </html>
    I cant see the error, all the directories in there exist and are 777

  2. #2
    ScottDiamond Guest

    Default

    Whats line 38? I can't be assed counting.

  3. #3
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Nvm lol... new problem... it doesnt want to upload mp3's... any reason why?

  4. #4
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    have you tried uploading a normal picture?

  5. #5
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Yer, i use this code on other pages and it works fine.

    Its uploading all formats except MP3/MP4

  6. #6
    Join Date
    May 2005
    Posts
    348
    Tokens
    0

    Default

    does your host block them types of files?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •