$data=base64_decode(file_get_contents("encodedfile.txt")); $f=fopen("decode.out","w"); fputs($f,$data); fclose($f);