需要的地方加上:onclick=showActionSheet();
var uploadHttp = www.com.cn/upload.php;//请更换为你所使用的上传地址
function showActionSheet(){
uexWindow.cbActionSheet=function (opId, dataType, data)
{
if(data == 0)
{
paiopen();
}
else if(data == 1)
{
fileopen();
}
}
var value = "拍照上传;本地上传";
var mycars=value.split(";");
uexWindow.actionSheet("","取消",mycars);
}
function paiopen(){
uexCamera.cbOpen=function (opCode, dataType, data)
{
document.getElementById('pic').value = data;
upl0ad();
}
uexCamera.open();
}
function fileopen(){
uexImageBrowser.cbPick=function (opCode,dataType,data)
{
document.getElementById('pic').value = data;
upload();
}
uexImageBrowser.pick();
}
function uexWidgetOneErrorCb(opCode, errorCode, errorInfo){
uexWindow.toast('0','5',errorInfo,2000);
}
function UploaderMgronStatus(opCode,fileSize,percent,serverPath,status)
{
switch (status)
{
case 0:
break;
case 1:
uexWindow.closeToast();
uexUploaderMgr.closeUploader(opCode);
uexWindow.toast("0","5","上传头像成功!","3000");
break;
case 2:
uexWindow.closeToast();
uexWindow.toast('0','5',"上传失败",2000);
uexUploaderMgr.closeUploader(opCode);
break;
}
}
function UploaderMgrCreateUploaderCb(opCode,dataType,data){
if(data == 0){
var path = document.getElementById('pic').value;
uexUploaderMgr.onStatus = UploaderMgronStatus;
var inCompress = '3';
uexUploaderMgr.uploadFile(opCode,path,"upfile",inCompress);
}else{
uexWindow.closeToast();
uexWindow.toast('0','5',"上传失败",2000);
}
}
function upload()
{
uexWidgetOne.cbError = uexWidgetOneErrorCb;
uexUploaderMgr.cbCreateUploader = UploaderMgrCreateUploaderCb;
uexWindow.toast('1','5','正在上传...','');
uexUploaderMgr.createUploader('1',uploadHttp);
}I
var uploadHttp = www.com.cn/upload.php;//请更换为你所使用的上传地址
function showActionSheet(){
uexWindow.cbActionSheet=function (opId, dataType, data)
{
if(data == 0)
{
paiopen();
}
else if(data == 1)
{
fileopen();
}
}
var value = "拍照上传;本地上传";
var mycars=value.split(";");
uexWindow.actionSheet("","取消",mycars);
}
function paiopen(){
uexCamera.cbOpen=function (opCode, dataType, data)
{
document.getElementById('pic').value = data;
upl0ad();
}
uexCamera.open();
}
function fileopen(){
uexImageBrowser.cbPick=function (opCode,dataType,data)
{
document.getElementById('pic').value = data;
upload();
}
uexImageBrowser.pick();
}
function uexWidgetOneErrorCb(opCode, errorCode, errorInfo){
uexWindow.toast('0','5',errorInfo,2000);
}
function UploaderMgronStatus(opCode,fileSize,percent,serverPath,status)
{
switch (status)
{
case 0:
break;
case 1:
uexWindow.closeToast();
uexUploaderMgr.closeUploader(opCode);
uexWindow.toast("0","5","上传头像成功!","3000");
break;
case 2:
uexWindow.closeToast();
uexWindow.toast('0','5',"上传失败",2000);
uexUploaderMgr.closeUploader(opCode);
break;
}
}
function UploaderMgrCreateUploaderCb(opCode,dataType,data){
if(data == 0){
var path = document.getElementById('pic').value;
uexUploaderMgr.onStatus = UploaderMgronStatus;
var inCompress = '3';
uexUploaderMgr.uploadFile(opCode,path,"upfile",inCompress);
}else{
uexWindow.closeToast();
uexWindow.toast('0','5',"上传失败",2000);
}
}
function upload()
{
uexWidgetOne.cbError = uexWidgetOneErrorCb;
uexUploaderMgr.cbCreateUploader = UploaderMgrCreateUploaderCb;
uexWindow.toast('1','5','正在上传...','');
uexUploaderMgr.createUploader('1',uploadHttp);
}I