rendered paste body<?php // Sanitize the filename $title = preg_replace('/[^a-z0-9\_\-]+/', '', $_POST['Title']); if($tile == '') $title = 'default-'.date('Y-m-d_His'); // Generate the output $output = "{$title}\n". "{$_POST['Subtitle']}\n". str_repeat('-', strlen($_POST['Subtitle']))."\n\n". wordwrap($_POST['Text'])."\n\n". wordwrap($_POST['Footnote']); // Open the file for writing if($fp = fopen("files/{$title}.txt", 'w+')) { fwrite($fp, $output); fclose($fp); echo "File uploaded."; } else { echo "Failed opening files/{$title}.txt for writing."; }?>