//print_r($_GET);
echo "
 The following files are to be uploaded 
";
// need to remove the duplicate enteries
$tempfileNames=explode(':',$_GET['files']);
$titleId=$_GET['titleId'];
/*$fileName=array();
for($i=0;$i
 $val)
{	
	if(strlen($val)>0)
	{
		// need to enter to the database
		echo "checking 
 ".$val."...
";
		// check if the file is not present for the same values
		
		$name=getFileNameWithoutExtension($val);
		$query="Select * from OM_media where filename='".$val."' and title='".$titleId."'";
		$result=mysql_query($query);
		$num_rows = mysql_num_rows($result);
		if($num_rows==0)
		{
			// inserting
			echo "inserting 
".$val."
";
			$insertQuery="INSERT INTO OM_media (title,name,filename) VALUES ('".$titleId."','".$name."', '".$val."')";
			$insertResult=mysql_query($insertQuery);
			//echo $insertQuery;
		}
		else
		{
			echo $val." already exists 
";
		}
		
	}
}
// this will return the file name without the extension
function getFileNameWithoutExtension($fileName)
{
	//echo $fileName;
	$extensionPosition=strrpos($fileName,".");
	//echo $extensionPosition;
	$fileNameWithoutExtension=substr($fileName,0,$extensionPosition);
	return $fileNameWithoutExtension;
}
?>
[ back to batch upload ]