Home > Backend Development > PHP Tutorial > Asynchronous file upload using Snoopy proxy_PHP tutorial

Asynchronous file upload using Snoopy proxy_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 14:58:37
Original
868 people have browsed it

Use formdata combined with snoopy for request forwarding to implement non-form and non-iframe asynchronous file upload functions.

JS code:
document.getElementById('#file').change = function (e) {
var data = new FormData();

//Set parameters
data.append('nick', 'Bangyan');
data.append('session_id', '6fc373162b5e8a78a255777e0108a0b3');
data.append('file', e.currentTarget.files[0 ]);

}
PHP code:

require('Snoopy.class.php');
$action = 'http:// /localhost/upload.php';
$snoopy = new Snoopy();
$snoopy->_submit_type = 'multipart/form-data';
$snoopy->submit($action, $_REQUEST, $_FILES);
echo $snoopy->results;
// Downloads By http://www.bkjia.com

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/363795.htmlTechArticleUse formdata combined with snoopy for request forwarding to implement non-form and non-iframe asynchronous file upload functions. JS code: document.getElementById('#file').change = funct...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template