I have a question
i have an textarea for user to key in and a button for user to save what they key in into the textarea.
if i key in '"\ in to textarea
and i press the button save the file, the file is not shown '"\, it shows \'\"\\,
Why the file was added in this symbol \ inside my file? This will not happen if i didn't key in these three symbols.
Below is my phpcode and html code.
phpcode
Expand|Select|Wrap|Line Numbers
- <?PHP
- // Check for user data.
- if ( $_POST['FileContent'] ) {
- // Create a unique-ish filename.
- $FileName = "testing.php";
- // Create and open the file.
- $FileHandle = fopen ( $FileName, 'w' );
- // Write the data.
- fwrite ( $FileHandle, $_POST['FileContent'] );
- // Close the file.
- fclose ( $FileHandle );
- // Set file header information.
- header ( 'Content-Type: text/html' );
- header ( 'Content-Description: File Transfer' );
- header ( 'Content-Disposition: attachment; filename="' . basename($FileName) . '"' );
- header ( 'Content-Length: ' . filesize($FileName) );
- // Push file to client.
- readfile($FileName);
- // Delete file.
- unlink($FileName);
- exit();
- }
- ?>
Expand|Select|Wrap|Line Numbers
- <form action="" method="post">
- <textarea name="FileContent"></textarea> <input type="submit">
- </form>
I would appreciate if any one can solve this from me.