Write Tags works on localhost, but not on live server

Post Reply
kiernan7
User
Posts: 1
Joined: Wed Jun 07, 2017 12:00 am
Are you a spambot?: no

Write Tags works on localhost, but not on live server

Post by kiernan7 » Wed Jun 07, 2017 12:08 am

I have this working fine in its exact form on localhost, as well as a slightly different version working on a BlueHost website. However, when I put this on another website, it fails ($tagwriter->WriteTags() returns a false).

Obviously, the getID3 is getting initialized, but for some reason this code below is failing. Does anyone have any idea why?

Thanks in advance!
-- John Kiernan
PS: I'm uploading MP3s only.

Code: Select all

	require_once('getid3/getid3.php');
	
	$title    = $_POST['title'];
	$title2   = $_POST['title2'];
	$artist   = $_POST['artist'];
	$date     = $_POST['date'];
	$trackno  = $_POST['trackno'];
	$filename = $_POST['hidfilename'];
	$album    = "A Vision 4 You Sunday Special Edition";
	
	$getID3 = new getID3;
	if (!$getID3) {
		echo '<h1>Error initializing getID3</h1>';
	}
	$TextEncoding = 'UTF-8';
	$getID3->setOption(array('encoding'=>$TextEncoding));
	require_once('getid3/write.php');
	
	$tagwriter = new getid3_writetags;
	$tagwriter->filename = $filename;
	$tagwriter->tagformats = array('id3v2.3');
	$tagwriter->overwrite_tags = true; 
	$tagwriter->remove_other_tags = false;
	$tagwriter->tag_encoding = $TextEncoding;
	$tagwriter->remove_other_tags = true;
	$oldtitle = $title."|".$title2;
	$year = substr($date, 6, 4);
//	$copyright = $date."|A Vision for You OA Group";
	$copyright = $date;
	
	if ($title2 != "") {
		$newtitle = $title." ".$title2;
	}
	$comment = $newtitle.", presented by ".$artist." on: ".$date." as a Vision for You Sunday Special Edition.";
	
	$TagData = array(
		'title' => array($oldtitle),
		'artist' => array($artist),
		'album' => array($album),
		'year' => array($year),
		'genre' => array("Speech"),
		'tracknumber' => array($trackno),
		'copyright' => array($copyright),
		'comment' => array($comment),
	);
	
	$tagwriter->tag_data = $TagData;
	
	if ($tagwriter->WriteTags()) {
		echo '<h1>Successfully uploaded and set ID3 tags<h1>';
		if (!empty($tagwriter->warnings)) {
			echo '<h1>There were some warnings:<br>'.implode('<br><br>', $tagwriter->warnings."</h1>");
		}
	} else {
		echo '<h1>Could not write tags</h1>');
	}		

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest