Hi friends here is me with another issue
i have practicing about file upload, my script working with images perfectly but if i choose mp3 audio file its not moving to the directory which i have specified in my code
here is my code

<?php
include ("header.html");
require ("config.php");
error_reporting(E_ALL);
$audio_title = $_POST['audio_title'];
$audio_detail = $_POST['audio_detail'];
$audio_filename = md5($_FILES['mp3file']['name']);
$tmp_file = $_FILES['mp3file']['tmp_name'];
$file_path = "./upload/".$audio_filename;

    $moveResult = move_uploaded_file($tmp_file, $file_path);
    if ($moveResult == true) {
    echo "File has been moved from " . $tmp_file . " to" . $file_path."<br />";
} else {
     echo "ERROR: File not moved correctly<br />";
}
    mysql_query("INSERT INTO songs (song_title, song_detail, song_url) VALUES('$audio_title', '$audio_detail', '$audio_filename')");
//    echo "The Mp3 File ".$audio_filename." Has Been Successfull Uploaded.<br />";
    echo "Upload another file <a href='mp3upload.php'>Click Here</a>";
    
include ("footer.html");

?>

Recommended Answers

All 2 Replies

If it works for some images but not mp3's, then the problem may be with file size. Your images maybe less than 2M that is why it is working. It is not uploading your mp3's probably because they are over 2M in size.
Open your php.ini file and read what the following lines mean:

post_max_size = 8M
upload_max_filesize = 2M

If they are like the ones show above, making the necessary changes, save, restart your server and try again.

cossay thanks for your fast reply, amazing IT Forum
now its working :)
could you explain me what these two lines work or meaning?
i little bit understand the 2 line upload_max_filesize = 2m
but the 1st one is not. plz explain thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.