<?php

$myfile = fopen($directory, "a+") or die("Unable to open file for storage paths!");
				chmod($directory, 0777);
				$packet = explode(PHP_EOL, $txt);
				for ($i= 0; $i < count($packet); $i++) { 
					# code...
					fwrite($myfile, $packet[$i]);
				}
				//fflush($myfile);
				
				fclose($myfile);


?>