Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've copied this upload script from somewhere on the net.
I've tried similar scripts in the past and been able to upload any file type apart from mp3s.
In this script I've added the line:Code: Select all
echo "This is type: " . $_FILES["file"]["type"];I've tried various different mp3s and they all have the same problem. As I said, all other file types (like word docs etc) upload ok (using other scripts).
Its an apache server and it does have mp3s as a registered mime type.
I can't think what else it could be? something on the server perhaps? I wouldn't think it is this code as I've just taken it from another site.
Cheers.
Code: Select all
<html>
<head>
<title>Upload MP3</title>
<?php
if($_POST['submit']=="Upload") {
if ($_FILES['file']['name'] != "") {
if (($_FILES['file']['type'] == "audio/mpeg") || ($_FILES['file']['type'] == "application/force-download")) {
if ($_FILES["file"]["size"] < 10097152) {
move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
echo "File has been stored in your uploads directory.";}
else { echo "Please upload a file that is under 10 mb!";}
} else {
echo "This is type: " . $_FILES["file"]["type"];
exit;}
} else { echo "Please enter a file.";}
}
?>
</head>
<body>
<p style="font-family: verdana;">Please select a file to upload: </p>
<br />
<form action="<?php echo $PHP_SELF ?>" method="post" enctype="multipart/form-data">
<input type="file" name="file" size="40" />
<br /><br />
<input type="submit" name="submit" value="Upload" />
<br /><br />
<span style="font-family: verdana; font-size: 12px;">* only mp3 files under 2 megabytes are allowed.</span>
</form>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]