Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use PHP+Ajax to realize the preview function of uploading profile picture without refresh

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "how to use PHP+Ajax to achieve no refresh upload profile picture preview function", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use PHP+Ajax to achieve non-refresh upload profile picture preview function" it!

Upload avatar area

充值

Introduce jQuery library and plupload upload component plupload single picture upload configuration var uploader_avatar = new plupload.Uploader ({/ / Construction method of instance creation runtimes: 'gears,html5,html4,silverlight,flash', / / priority order of which way to initialize the upload plug-in 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: '10mbupload, / / maximum upload file size (format 100b, 10kb, 10mb) 1gb) mime_types: [/ / allow file upload types {title: "files", extensions: "jpg,png,gif,jpeg"}]}, multi_selection: false, / / true:ctrl multiple file upload, false single file upload init: {FilesAdded: function (up, files) {/ / uploader_avatar.start before file upload () }, UploadProgress: function (up, file) {/ / upload, showing the progress bar var percent = file.percent; $("#" + file.id) .find ('.bar'). Css ({"width": percent + "%"}); $("#" + file.id) .find (".blank") .text (percent + "%") }, FileUploaded: function (up, file, info) {/ / trigger var data = eval ("(" + info.response + ")") when the file is uploaded successfully; / / parse the returned json data $("# avatar_pic") .html ("

")}, Error: function (up, err) {/ / trigger alert (err.message) when an upload error occurs;}); uploader_avatar.init () Thank you for your reading, the above is "how to use PHP+Ajax to achieve no refresh upload profile picture preview function" of the content, after the study of this article, I believe you on how to use PHP+Ajax to achieve no refresh upload profile picture preview function of this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report