加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php ajax实现的文件上传进度条

发布时间:2020-05-25 01:02:37 所属栏目:PHP 来源:互联网
导读:本实例是关于php文件上传时进度条的实现,主要采用ajax技术,例外还运用了html5,有需要的朋友可以研究一下。

本实例有两个文件:


upload_form.html:


HTML5 File Upload Progress Bar Tutorial


file_upload_parser.php:

$fileName = $_FILES["file1"]["name"]; // The file name

$fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder

$fileType = $_FILES["file1"]["type"]; // The type of file it is

$fileSize = $_FILES["file1"]["size"]; // File size in bytes

$fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true

if (!$fileTmpLoc) { // if file not chosen

echo "ERROR: Please browse for a file before clicking the upload button.";

exit();

}

if(move_uploaded_file($fileTmpLoc,"test_uploads/$fileName")){

echo "$fileName upload is complete";

} else {

echo "move_uploaded_file function failed";

}

?>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读