[![Build Status](https://travis-ci.org/google/google-api-php-client.svg?branch=master)](https://travis-ci.org/google/google-api-php-client) # Google APIs Client Library for PHP # The Google API Client Library enables you to work with Google APIs suc
今天我给大家分享的是在不刷新页面的前提下,使用PHP+jQuery+Ajax实现多图片上传的效果。用户只需要点击选择要上传的图片,然后图片自动上传到服务器上并展示在页面上。
HTML
我们在页面上放置一个form表单,使用post提交到后台php处理程序upload.php,注意enctype属性设置要支持文件上传。#preview用来显示上传完毕后的图片。关于css样式设置本文不加说明,请参照下载包的源码。
代码如下:
本文实例为大家分享了微信小程序上传图片到php服务器的具体代码,供大家参考,具体内容如下
js代码如下
submitPhoto(){
var that = this;
wx.uploadFile({
url: 'http://xxx.cn/upload.php', //仅为示例,非真实的接口地址
filePath: imagePath,
name: 'imgfile',
success: function (res) {
var data = JSON.parse(r