Created
October 20, 2014 19:15
-
-
Save techslides/5df05f62f2a034ee537c to your computer and use it in GitHub Desktop.
Save Ajax POST data as a file with PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(E_ALL); | |
//var_dump($_SERVER); | |
$post_data = $_POST['data']; | |
if (!empty($post_data)) { | |
$dir = 'YOUR-SERVER-DIRECTORY/files'; | |
$file = uniqid().getmypid(); | |
$filename = $dir.$file.'.txt'; | |
$handle = fopen($filename, "w"); | |
fwrite($handle, $post_data); | |
fclose($handle); | |
echo $file; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://icecrean.samane.etbarat.ootp.ir/NewIPG/Content/New97/Images/keypad.png