This file contains 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
<form id="my_form" method="post" action="upload.php" enctype="multipart/form-data"> | |
<input type="text" name="title"> | |
<textarea name="content"></textarea> | |
<input type="file" name="image" accept="image/*"> | |
<button type="submit">OK</button> | |
</form> |
This file contains 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
$(function () { | |
$('#my_form').on('submit', function (e) { | |
// prevent browser from submitting the form | |
e.preventDefault(); | |
var $form = $(this); | |
$.ajax({ | |
url: $form.attr('action'), | |
type: $form.attr('method'), |
This file contains 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
[ | |
{ | |
"Book":{ | |
"id":"51", | |
"title":"Le Journal D\u2019une Femme De Chambre 01", | |
"preview":"\/mp3\/Octave_Mirbeau_-_Le_Journal_d_une_femme_de_chambre_Chap01.mp3", | |
"image":"\/sounds\/cover\/1\/51.webp", | |
"top":false, | |
"category_id":"16", |
This file contains 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 | |
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead | |
// of $_FILES. | |
$uploaddir = '/var/www/uploads/'; | |
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); | |
echo '<pre>'; | |
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { | |
echo "File is valid, and was successfully uploaded.\n"; |
This file contains 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 | |
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead | |
// of $_FILES. | |
$uploaddir = '/uploads/'; | |
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); | |
echo '<pre>'; | |
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { | |
echo "File is valid, and was successfully uploaded.\n"; |
This file contains 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
<!-- The data encoding type, enctype, MUST be specified as below --> | |
<form enctype="multipart/form-data" action="upload.php" method="POST"> | |
<!-- MAX_FILE_SIZE must precede the file input field --> | |
<input type="hidden" name="MAX_FILE_SIZE" value="30000" /> | |
<!-- Name of input element determines name in $_FILES array --> | |
Send this file: <input name="userfile" type="file" /> | |
<input type="submit" value="Send File" /> | |
</form> |
This file contains 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
var http = require('http'); | |
var fs = require('fs'); | |
var ent = require('ent') | |
var mysql = require('mysql'); | |
var server = http.createServer(function(req, res) { | |
fs.readFile('./index.php', 'utf-8', function(error, content) { | |
res.writeHead(200, {"Content-Type": "text/html"}); |
This file contains 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
{ | |
"name": "realtime", | |
"version": "1.0.0", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<?php echo $this->Html->charset(); ?> | |
<title> | |
<?php echo $this->fetch('title'); ?> | |
</title> | |
<!-- Material Design fonts --> | |
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700"> | |
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons"> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<?php echo $this->Html->charset(); ?> | |
<title> | |
<?php echo $this->fetch('title'); ?> | |
</title> | |
<!-- Material Design fonts --> | |
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700"> | |
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/icon?family=Material+Icons"> |