search
Homephp教程php手册PHP personal center avatar upload demonstration and download

To implement the steps, introduce the plupload upload plug-in and set multi_selection to single file upload.
PHP personal center avatar upload demonstration and download
Upload avatar code: var uploader_avatar = new plupload.Uploader({//Construction method to create an instance <code class="prettyprint linenums lang-php">var uploader_avatar = new plupload.Uploader({//创建实例的构造方法 <br>     runtimes: 'gears,html5,html4,silverlight,flash', //上传插件初始化选用那种方式的优先级顺序 <br>     browse_button: ['avatar_uplpad_btn'], // 上传按钮 <br>     url: "ajax.php", //远程上传地址 <br>     flash_swf_url: 'js/plugins/plupload/Moxie.swf', //flash文件地址 <br>     silverlight_xap_url: 'js/plugins/plupload/Moxie.xap', //silverlight文件地址 <br>     filters: { <br>         max_file_size: '10mb', //最大上传文件大小(格式100b, 10kb, 10mb, 1gb) <br>         mime_types: [//允许文件上传类型 <br>             {title: "files", extensions: "jpg,png,gif,jpeg"} <br>         ] <br>     }, <br>     multi_selection: false, //true:ctrl多文件上传, false 单文件上传 <br>     init: { <br>         FilesAdded: function(up, files) { //文件上传前 <br>  <br>             uploader_avatar.start(); <br>         }, <br>         UploadProgress: function(up, file) { //上传中,显示进度条 <br>             var percent = file.percent; <br>             $("#"   file.id).find('.bar').css({"width": percent   "%"}); <br>             $("#"   file.id).find(".percent").text(percent   "%"); <br>         }, <br>         FileUploaded: function(up, file, info) { //文件上传成功的时候触发 <br>             var data = eval("("   info.response   ")");//解析返回的json数据 <br>             $("#avatar_pic").html("<img alt="PHP personal center avatar upload demonstration and download" >") <br>         }, <br>         Error: function(up, err) { //上传出错的时候触发 <br>             alert(err.message); <br>         } <br>     } <br> }); <br> uploader_avatar.init(); Runtimes: 'gears,html5,html4,silverlight,flash', //The priority order of upload plug-in initialization method

​​browse_button: ['avatar_uplpad_btn'], // Upload button

URL: "ajax.php", //Remote upload address

Flash_swf_url: 'js/plugins/plupload/Moxie.swf', //flash file address Silverlight_xap_url: 'js/plugins/plupload/Moxie.xap', //silverlight file address Filters: {          max_file_size: '10mb', //Maximum upload file size (formats 100b, 10kb, 10mb, 1gb)           mime_types: [//Allow file upload types {title: "files", extensions: "jpg,png,gif,jpeg"} ] }, Multi_selection: false, //true:ctrl multi-file upload, false single file upload init: { FilesAdded: function(up, files) { //Before uploading files                  uploader_avatar.start();         }, UploadProgress: function(up, file) { //Uploading, display progress bar                    var percent = file.percent;  $ ("#" File.id) .find ('. Bar'). CSS ({"width": percent "%"}); $ ("#" File.id) .find (". Percent"). Text (percent "%");         }, FileUploaded: function(up, file, info) { //Triggered when file upload is successful           var data = eval("(" info.response ")");//Parse the returned json data               $("#avatar_pic").html("PHP personal center avatar upload demonstration and download")          }, ​​​​ Error: function(up, err) { //Triggered when an upload error occurs alert(err.message);          }  }   }); uploader_avatar.init();Online upload avatar demonstration: http://www.sucaihuo.com/js/880.html Cloud Conference Beijing Station: Alibaba technical experts rarely make an appearance, this time they are here More than 100 people? !
Statement
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
了解Python编程的入门级代码示例了解Python编程的入门级代码示例Jan 04, 2024 am 10:50 AM

了解Python编程的入门级代码示例Python是一种简单易学,功能强大的编程语言。对于初学者来说,了解Python编程的入门级代码示例是非常重要的。本文将为您提供一些具体的代码示例,帮助您快速入门。打印HelloWorldprint("HelloWorld")这是Python中最简单的代码示例。print()函数用于将指定的内容输出

PHP переменные в действии: 10 реальных примеров использованияPHP переменные в действии: 10 реальных примеров использованияFeb 19, 2024 pm 03:00 PM

PHP变量存储程序运行期间的值,对于构建动态且交互式的WEB应用程序至关重要。本文将深入探讨php变量,并通过10个真实的示例展示它们的实际应用。1.存储用户输入$username=$_POST["username"];$passWord=$_POST["password"];此示例从表单提交中提取用户名和密码,并将其存储在变量中以供进一步处理。2.设置配置值$database_host="localhost";$database_username="username";$database_pa

从入门到精通:Go语言中常用数据结构的代码实现从入门到精通:Go语言中常用数据结构的代码实现Mar 04, 2024 pm 03:09 PM

标题:从入门到精通:Go语言中常用数据结构的代码实现数据结构在编程中起着至关重要的作用,它是程序设计的基础。在Go语言中,有许多常用的数据结构,掌握这些数据结构的实现方式对于成为一名优秀的程序员至关重要。本文将介绍Go语言中常用的数据结构,并给出相应的代码示例,帮助读者从入门到精通这些数据结构。1.数组(Array)数组是一种基本的数据结构,是一组相同类型

如何使用PHP编写库存管理系统中的库存分仓管理功能代码如何使用PHP编写库存管理系统中的库存分仓管理功能代码Aug 06, 2023 pm 04:49 PM

如何使用PHP编写库存管理系统中的库存分仓管理功能代码库存管理是许多企业中不可或缺的一部分。对于拥有多个仓库的企业来说,库存分仓管理功能尤为重要。通过合理管理和跟踪库存,企业可以实现不同仓库之间的库存调拨,优化运营成本,改善协同效率。本文将介绍如何使用PHP编写库存分仓管理功能的代码,并为您提供相关的代码示例。一、建立数据库在开始编写库存分仓管理功能的代码之

Java实现简单的冒泡排序代码Java实现简单的冒泡排序代码Jan 30, 2024 am 09:34 AM

Java冒泡排序最简单的代码示例冒泡排序是一种常见的排序算法,它的基本思想是通过相邻元素的比较和交换来将待排序序列逐步调整为有序序列。下面是一个简单的Java代码示例,演示了如何实现冒泡排序:publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){int

Go语言编程实例:Web开发中的代码示例Go语言编程实例:Web开发中的代码示例Mar 04, 2024 pm 04:54 PM

《Go语言编程实例:Web开发中的代码示例》随着互联网的快速发展,Web开发已经成为各行业中必不可少的一部分。作为一门功能强大且性能优越的编程语言,Go语言在Web开发中越来越受到开发者们的青睐。本文将通过具体的代码示例,介绍如何利用Go语言进行Web开发,让读者能够更好地理解和运用Go语言来构建自己的Web应用。1.简单的HTTP服务器首先,让我们从一个

华为云边缘计算对接指南:Java代码示例快速实现接口华为云边缘计算对接指南:Java代码示例快速实现接口Jul 05, 2023 pm 09:57 PM

华为云边缘计算对接指南:Java代码示例快速实现接口随着物联网技术的快速发展和边缘计算的兴起,越来越多的企业开始关注边缘计算的应用。华为云提供了边缘计算服务,为企业提供了高可靠的计算资源和便捷的开发环境,使得边缘计算应用更加容易实现。本文将介绍如何通过Java代码快速实现华为云边缘计算的接口。首先,我们需要准备好开发环境。确保你已经安装了Java开发工具包(

指导与示例:学习Java选择排序算法的实现指导与示例:学习Java选择排序算法的实现Feb 18, 2024 am 10:52 AM

Java选择排序法代码编写指南及示例选择排序是一种简单直观的排序算法,其思想是每次从未排序的元素中选择最小(或最大)的元素进行交换,直到所有元素排序完成。本文将提供选择排序的代码编写指南,并附上具体的Java示例代码。算法原理选择排序的基本原理是将待排序数组分为已排序和未排序两部分,每次从未排序部分选择最小(或最大)的元素,将其放到已排序部分的末尾。重复上述

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools