[SOLVED] Upload problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sinewave
Forum Commoner
Posts: 41
Joined: Tue Sep 10, 2002 4:35 pm
Location: Canada

[SOLVED] Upload problem

Post by sinewave »

I am having trouble with uploading MP3 files using the following code....any smaller MP3 files seem to work, and it always makes the m3u for me, but for some reason on any bigger mp3 files 3meg+ it uploads for a while, creates the m3u but the mp3 does not show up. Is there some sort of time out limitation or does someone have a better way for me to do this? Any help would be greatly appreciated.

Code: Select all

$target = "../audio"; 

	if (is_dir($target) AND is_writable($target)) 
	{
		$oldName = $HTTP_POST_FILESї'mp3']ї'name'];
		$newName = str_replace(" ", "_", $oldName);
		
		$fExplode = explode(".",$newName);
		$m3u = addslashes($HTTP_GET_VARSї"ID"])."-".$fExplodeї0].".m3u";
		echo "m3u: ".$m3u;
  
		if (!$file_handle = fopen("../audio/".$m3u,"a")) 
		{
			echo "Cannot open file"; 
		}  
	
		if (!fwrite($file_handle, "http://www.example.com/audio/".$newName)) 
		{
			echo "Cannot write to file"; 
		}  
		echo "You have successfully written m3u file.";   
		fclose($file_handle); 
		copy($HTTP_POST_FILESї'mp3']ї'tmp_name'], "$target/$newName"); 
		echo $filename . " has been received.<br>";
	&#125;
	else
	&#123;
		echo $target. ': either invalid or write permission denied';
		exit();
	&#125;
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

well there is the max_upload_size in your php.ini file and there is also somtin that is a auto time out setting so like after 4 minutes of continuous use it just stopps. check on both of those
sinewave
Forum Commoner
Posts: 41
Joined: Tue Sep 10, 2002 4:35 pm
Location: Canada

Post by sinewave »

Thanks alot, that was the problem.
Post Reply