I use several variations on this basic upload script, and it works fine with all my image and text files (I stripped out all the file type testing and checking functions). However when I use the same script with any .mp3 file, all I get an ie "Page Cannot be displayed" error. I can't seem to find any other error info. This is driving me nuts.
<?php
session_start();
if ( !$SESSION[mp3] or $SESSION[mp3] == 0 ) {
$SESSION[mp3] = 1; ?>
<p><strong>Choose file to upload</strong>
<form enctype="multipart/form-data" method="post" action="<?php print $SERVER[PHP_SELF] ?>">
<input type="hidden" name="MAX_FILE_SIZE" value="6000000">
<input type="file" name="user_file">
<p><input type="submit" name="change" value="Select">
</form>
<?php
} else if ( $SESSION[mp3] == 1 ) {
$source_file = $FILES['user_file']['name'];
$upload_dir = "/var/www/sharkbytebands/mp3/";
$uploadfile = $upload_dir . $source_file;
if ( move_uploaded_file($FILES['user_file']['tmp_name'], $uploadfile) ) {
echo "<p><b>file upload successful</b>";
} else {
echo "<p><b>file upload failed</b>";
}
$SESSION[mp3] = 0;
echo "<p><a href=\"$_SERVER[PHP_SELF]\">return to upload form</a>";
}
?>
Any help?
Thanks-
DC