Need to save some big data to file on server
"/php/test.php":
<?php if(!empty($_POST['data'])){
$data = $_POST['data'];
$fname = mktime() . ".txt";
$file = fopen("upload/" .$fname, 'w');
fwrite($file, $data);
fclose($file);
}
?>
jquery:
var data = 'foo bar';
$.ajax({
url: 'php/test.php',
type: 'POST',
data: { data: data },
success: function(result) {
alert('the data was successfully sent to the server');
}
});
result:
405 (HTTP method POST is not supported by this URL)
what's the problem?