test_picture = function() {
api.getPicture({
sourceType: 'library',
encodingType: 'png',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
//quality: ,
//targetWidth:,
//targetHeight:,
saveToPhotoAlbum: false
}, function(ret, err){
if (ret) {
api.ajax({
timeout : ,
method : 'post',
url : 'http://192.168.1.121/picture.php',
data : {
files:{upfile : ret.data},
},
dataType : 'json',
}, function(ret, err) {
api.hideProgress();
alert(JSON.stringify(ret));
});
} else {
api.alert({msg:err.msg});
};
});
}; PHP接收图片
<?php
function getname($exname){
$dir = "./uploadfile/";
$i=;
if(!is_dir($dir)){
mkdir($dir,);
}
while(true){
if(!is_file($dir.$i.".".$exname)){
$name=$i.".".$exname;
break;
}
$i++;
}
return $dir.$name;
} $exname=strtolower(substr($_FILES['upfile']['name'],(strrpos($_FILES['upfile']['name'],'.')+))); $uploadfile = getname($exname); if (move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile)) { echo "<h2><font color=#ff0000>文件上传成功!</font></h2><br><br>"; } else { echo "<h2><font color=#ff0000>文件上传失败!</font></h2><br><br>"; }
?>

最新文章

  1. 喜马拉雅音频下载器 V1.2 支持专辑批量下载 喜马拉雅mp3下载导出 喜马拉雅下载器
  2. Texture tiling and swizzling
  3. window安装jekyll
  4. 解决IIS7.0服务和用户上传的文件分别部署在不同的电脑上时,解决权限的问题
  5. 如何解决phpcms后台验证码不显示的问题
  6. 在启动dubbo框架时报错。Unable to connect to zookeeper server within timeout: 5000
  7. linux下IM server搭建
  8. div与&gt;div区别小结
  9. Web Development Terms
  10. jstl中添加自定义的函数
  11. mysql免安装版使用
  12. 非滤波单目视觉slam笔记1
  13. 【BZOJ4805】欧拉函数求和(杜教筛)
  14. Springboot整合log4j2【详细步骤】
  15. LeetCode(41)-Rectangle Area
  16. codeForces 472D 最小生成树
  17. 系列文章|OKR与敏捷(三):赋予团队自主权
  18. 查看macOS下正在使用的zsh
  19. 【MySQL】常用监控指标及监控方法
  20. Unable to convert MySQL date/time value to System.DateTime问题解决方案

热门文章

  1. 企业版 Linux 附加软件包(EPEL)
  2. UOJ #214 合唱队形 (概率期望计数、DP、Min-Max容斥)
  3. Photoshop教程
  4. Docker入门介绍
  5. 11153 kill boss
  6. linux下怎样将sheduler绑定到制定的cpu核上
  7. ScrollViewer滚动究竟来触发载入数据的Behavior
  8. bootstrap搜索样式
  9. C语言 - typedef struct 与struct
  10. php中一个经典的!==的用法