0

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");

?>
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by tahirkhanafridi
0

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.

Edited by cossay: n/a

0

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!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.