Jump to content

[SOLVED] Uploading mp3s


mattachoo

Recommended Posts

I have a simple form that is beings used to upload files.  As of now, it uploads small files just about fine.  Upload a small .gif file, no problem!  Unfortunately, I need it to upload mp3s.  Now, when I upload it, it loads the page for a long time, then eventually displays a blank white page.  And there is no mp3 in the directory when I check in my FTP program.  I think it is timing out on the file size or something.  Something with the php.ini file... I dont really know.  If anyone could help me out on this, it would save me tons of trouble.  THANKS!

[code]
<?php
//upload.php
?>
<html>
<head>


<title>Upload</title>
</head>
<body><br><br><br><br><br>
<table cellpadding="5" cellspacing="1" width="450" align="center">
<tr><td class="large">Upload</td></tr>
<!--this row holds everything-->
<tr><td>
<br><table width="250"><tr><td width="10" align="left">
<form action="doupload.php" method=post enctype="multipart/form-data">
<b>Pass:</b>

</td>
<td width="90%"><INPUT TYPE=password NAME=password MAXLENGTH=40s></td></tr></table>
<br>
<br>
<table width="250" cellpading="5">
<tr><td class="border3" width="30" align="left"><b>The file:</b></td>
<td width="70%"><INPUT TYPE="file" NAME="userfile"></td></tr></table><div align="left"><INPUT TYPE=SUBMIT NAME=post VALUE="Upload" ></form><br>

</table></td></tr></table>

</body>
</html>[/code]

doupload.php:
[code]<?php
//doupload.php


$pass = $_POST['password'];

$name = $_FILES['userfile']['name'];
$size = $_FILES['userfile']['size'];
$path = "/var/www/html/mp3s/";
$max_size = 20000000000000000000;
$newdate = date("n-j-y");


if (md5($pass)=="7e04d3f879ff349cb8e5d87fe26627db") {



if (!isset($_FILES['userfile'])) exit;

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {

if ($_FILES['userfile']['size']>$max_size) { echo "The file is too big<br>\n"; exit; }
//if (($_FILES['userfile']['type']=="audio/mpeg")) {

if (file_exists($path . $_FILES['userfile']['name'])) { echo "The file already exists<br>\n"; exit; }

$res = copy($_FILES['userfile']['tmp_name'], $path .
$_FILES['userfile']['name']);
if (!$res) { echo "upload failed!<br>\n"; exit; } else { echo "upload sucessful<br>\n"; }


echo "File Name: ".$_FILES['userfile']['name']."<br>\n";
echo "File Size: ".$_FILES['userfile']['size']." bytes<br>\n";
echo "File Type: ".$_FILES['userfile']['type']."<br>\n";
echo '<a href="/newframeset1.php">Index</a>';

//} else { echo "Wrong file type<br>\n"; exit; }

}
} else {
echo 'WRONG PASSWORD, IDIOT!'; exit;
}

?>[/code]
Link to comment
Share on other sites

Yes, this is what I expect the problem to be.  However, I do not know how to change these values in the php.ini file.  More help please!

**EDIT**

My host doesn't allow for its members to access the ini file.  They would however change it for me.  The upload max file size is now 24mb.  Sweet.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.