mattachoo Posted December 20, 2006 Share Posted December 20, 2006 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] Quote Link to comment Share on other sites More sharing options...
fert Posted December 20, 2006 Share Posted December 20, 2006 you shouldn't use $HTTP_POST_FILES you should use $_FILES Quote Link to comment Share on other sites More sharing options...
mattachoo Posted December 20, 2006 Author Share Posted December 20, 2006 Yeah, you are right, this is a really old code. I changed it, and it doesn't do anything. It can still upload small files, but not the big files. More help please? Quote Link to comment Share on other sites More sharing options...
Crusader Posted December 20, 2006 Share Posted December 20, 2006 You might be exceeding maximum script execution time, script memory, or the maximum size of uploads. Try checking your php.ini settings to see if any of those are the problem. Quote Link to comment Share on other sites More sharing options...
mattachoo Posted December 20, 2006 Author Share Posted December 20, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.