1***@qq.com
1***@qq.com
  • 发布:2018-08-09 12:07
  • 更新:2018-08-09 12:14
  • 阅读:18156

uni-app怎么获取本地文件目录

分类:uni-app

<input id="file" type="file" style="display: none;" onchange="fileport()" />
function fileport() {
$('.mui-content').find('.Pegam').remove()
var filest = document.getElementById('file').files[0];
let bianb = filest.name.substring(filest.name.length - 3).toLowerCase();
let panduan = ['jpg', 'png', 'pdf', 'jpeg'];
for(let i = 0; i < panduan.length; i++) {
if(bianb == panduan[i]) {
mui.toast('上传成功')
$('.noneshuju').hide()
$('.clicbas').show()
let pop = '<img class="Pegam" src="' + getObjectURL(filest) + '"/>'
$('.mui-content').append(pop)
$('.mui-content').css('margin-bottom', '40px')
return
} else {
mui.toast('上传失败')
return
}
}
}
这是mui里的。
但是在uni中又什么方法可以直接获取到。请官方大人明察

2018-08-09 12:07 负责人:无 分享
已邀请:
Neil_HL

Neil_HL

uni暂时不支持input得到file,可以使用uni.chooseImage或uni.chooseVideo得到图片视频的路径,然后调用uni.uploadFile上传

  • 1***@qq.com (作者)

    想获取PDF格式的文件目前也是不支持的吗


    2018-08-09 13:03

  • Neil_HL

    回复 1***@qq.com:暂时还不行


    2018-08-09 13:14

  • 1***@qq.com

    请问 可以获取完整路径吗 一般存储图片得到的路径都是

    _doc/uniapp_temp/compressed/1544012670489.png 这种格式

    我在手机里看了一下 前面还有前缀

    请问uniapp里有提供获取完整路径的这种方法吗


    2018-12-05 20:31

  • 1***@163.com

    文件怎么得


    2019-01-21 14:35

  • 1***@163.com

    求解!iOS怎么选取word文档?或者在其他应用打开 链接uni-app的方法


    2019-01-25 11:55

  • elpsycongroo

    回复 1***@qq.com:

    可以将相对路径转换成绝对的 var path=plus.io.convertLocalFileSystemURL(url);

    例如:/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/uniapp_temp/1584934674446.png 1584934899554


    2020-03-23 12:01

  • 7***@qq.com

    回复 elpsycongroo: 你好,想问一下,下载文件怎么存储到手机指定的目录,android端


    2020-07-06 17:18

  • 易软

    回复 7***@qq.com: 同问


    2020-11-20 10:44

该问题目前已经被锁定, 无法添加新回复