Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var filename = "mysave.txt"
- var contents = "xyz";
- document.location = "htmlsave.php?filename=" + filename + "&contents=" + contents;
- if(!isset($_GET)) {
- exit(0);
- }
- $filename = $_GET['filename'];
- $contents = $_GET['contents'];
- header("Pragma: public"); // required
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: private", false); // required for certain browsers
- header("Content-Type: application/octet-stream");
- header("Content-Disposition: attachment; filename="" . $filename . "";" );
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: " . strlen($contents));
- header("Connection: close");
- echo $contents;
- var i;
- var filename = "mysave.txt"
- var contents = "";
- for(i=0, contents = "";i<10000;i++){
- contents += "x";
- }
- document.location = "htmlsave.php?filename=" + filename + "&contents=" + contents;
- var filename = "mysave.txt"
- var contents = "";
- for(i=0, contents = "";i<10000;i++){
- contents += "x";
- }
- dataARR = {
- filename: filename,
- contents: contents
- };
- var dataJSON = JSON.stringify(dataARR);
- $.ajax({
- type: "POST", // This for array
- url: "htmlsave.php",
- async: true,
- cache: false,
- crossDomain: false, // This needs to be true for other people
- data: { myJson: dataJSON },
- success: function (data) {
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- }
- });
- if(!isset($_POST) || !isset($_POST['myJson'])) {
- exit(0);
- }
- $dataTotal = json_decode($_POST['myJson'], true);
- $filename = $dataTotal['filename'];
- $contents = $dataTotal['contents'];
- header("Pragma: public"); // required
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: private", false); // required for certain browsers
- header("Content-Type: application/octet-stream");
- header("Content-Disposition: attachment; filename="" . $filename . "";" );
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: " . strlen($contents));
- header("Connection: close");
- echo $contents;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement