yo peeps,
can anyone help me with this problem which is burning away at my brain and has been for a while. the php script below is used to upload mp3 file onto a server. it works fine in php4 but when i switch to php5 it returns with the first error. 'ERROR: Please browse for an mp3 before you press submit' At first i thought it might be the tmp_name but im not sure.
if ($_POST['parse_var'] == "mp3"){
if (!$_FILES['fileField']['tmp_name']) {
$error_msg = '<font color="#FF0000">ERROR: Please browse for an mp3 before you press submit.</font>'; [/color]
} else {
$maxfilesize = 20051200;
if($_FILES['fileField']['size'] > $maxfilesize ) {
$error_msg = '<font color="#FF0000">ERROR: Your mp3 was too large, please try again.</font>';
unlink($_FILES['fileField']['tmp_name']);
} else if (!preg_match("/\.(mp3)$/i", $_FILES['fileField']['name'] ) ) {
$error_msg = '<font color="#FF0000">ERROR: Your mp3 was not one of the accepted formats, please try again.</font>';
unlink($_FILES['fileField']['tmp_name']);
} else {
$rand= rand(1,3);
$newname="song$rand.mp3";
$place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "members/$id/".$newname);
$success_msg = '<font color="#009900">Your mp3 has been updated, it may take a few minutes for the changes to show... please be patient.</font>';
}
}
}
why will this mp3 upload script work in php4 and not 5
Moderator: General Moderators