跳转到主内容
websoft网络软件专家 - 深耕网络技术,打造实用软件!

php+js实现异步图片上传实例分享_PHP教程

upload.

php复制代码代码如下:php
index.html复制代码代码如下:Html5 Ajax 上传文件var xhr;function createXMLHttpRequest(){if(window.ActiveXObject){xhr = new ActiveXObject("Microsoft.XMLHTTP");}else if(window.XMLHttpRequest){xhr = new XMLHttpRequest();}}function UpladFile(){var fileObj = document.getElementById("file").files[0];var FileController = 'upload.php';var form = new FormData();form.append("myfile", fileObj);createXMLHttpRequest();xhr.onreadystatechange = handleStateChange;xhr.open("post", FileController, true);xhr.send(form);}function handleStateChange(){if(xhr.readyState == 4){if (xhr.status == 200 || xhr.status == 0){var result = xhr.responseText;var json = eval("(" + result + ")");alert('图片链接:\n'+json.file);}}}PHP 8.5.5 PHP 8.5.5 是 PHP 8.5 分支的维护更新版本。该版本延续了“小步快跑”的迭代逻辑,通过深度错误修复、底层性能微调以及安全加固,旨在为开发者提供一个更健壮、更高效的运行环境。该版本严格遵守语义化版本规范,不包含破坏性变更。

下载图片浏览...

上传http://www.bkjia.com/PHPjc/779158.html www.bkjia.com true http://www.bkjia.com/PHPjc/779158.html TechArticle upload.php 复制代码 代码如下: ?php if(isset($_FILES["myfile"])) { $ret = array(); $uploadDir = 'images'.DIRECTORY_SEPARATOR.date("Ymd").DIRECTORY_SEPARATOR; $dir = dirname(...

相关文章