当前位置: 首页 > news >正文

做招标应该关注什么网站抖音关键词优化排名靠前

做招标应该关注什么网站,抖音关键词优化排名靠前,东莞什么行业做网站的多,wordpress 肝病医院react native获取本地图片我用的react-native-image-picker,但是它只能获取图片路径,以及base64的图片,不能获取到binary二进制形式的。 一开始我是让后端改造接口,把原本传binary的改成了base64,可是,躲得…

react native获取本地图片我用的react-native-image-picker,但是它只能获取图片路径,以及base64的图片,不能获取到binary二进制形式的。

一开始我是让后端改造接口,把原本传binary的改成了base64,可是,躲得了初一躲不过十五。

上传视频是不可能走base64这种取巧的途径,于是,怎么把媒体文件转成binary给后端就成为了跨不过的坎。

找了好久的资料,总是能得到以下的的回答:

let formData = new FormData();let file = { uri: uri, type: 'multipart/form-data', name: 'a.jpg' };formData.append("images", file);fetch(url, {method: 'POST',headers: {'Content-Type': 'multipart/form-data',},body: formData,}).then((response) => response.text()).then((responseData) => {console.log('responseData', responseData);}).catch((error) => { console.error('error', error) });

首先这段代码我尝试了许多次都无法把它用multipart/form-data传输,后来发现,不写Content-Type它默认倒是识别正确了!然而第二个问题我始终无法解决,就是uri通过picker拿到的只是个路径,后端是无法将这本地路径去识别成文件的,试了无数次后最终将其放弃。

所以又回到了如何把媒体文件转成binary的问题上。(使用:react-native-fs不知道行不行得通,没试过)反正const response = await fetch(FILE_LOCAL_URL); const blob = await response.blob();是行不通的。

最终,我还是通过npm搜索react native blob找到了组件:react-native-blob-util,通过它的API,总算是把文件成功传给后端接口识别了:

import { getHeader } from './common';
import { launchImageLibrary } from 'react-native-image-picker';
import { base } from '~/utils/base';
import ReactNativeBlobUtil from 'react-native-blob-util';/** 上传图片获取url */
export function fetchUpload(fileModular, cb, isVideo) {launchImageLibrary({ mediaType: isVideo ? 'video' : 'photo' }, async res => {const curFiles = res.assets;if (curFiles) {const m = curFiles[0];if (m.fileSize > 1024 * 1024 * 10) {base.fail('图片过大,请上传10MB以内的图片');} else {base.load();const headers = await getHeader('multipart/form-data');ReactNativeBlobUtil.fetch('POST', `${global.api}/api/upload`, {...headers,}, [{ name: 'file', filename: m.fileName, type: m.type, data: ReactNativeBlobUtil.wrap(m.uri) },{ name: 'fileModular', data: fileModular },]).then((res) => {const json = JSON.parse(res.data)cb(json.data.res);}).catch((err) => {console.log(err)}).finally(() => {base.stop();})}} else {base.fail('请选择图片');}})
}


文章转载自:
http://depositary.c7513.cn
http://uncorrectable.c7513.cn
http://eelspear.c7513.cn
http://interclass.c7513.cn
http://forbore.c7513.cn
http://electrics.c7513.cn
http://pomatum.c7513.cn
http://pukeko.c7513.cn
http://revolutionology.c7513.cn
http://oviform.c7513.cn
http://seraskier.c7513.cn
http://foamback.c7513.cn
http://misteach.c7513.cn
http://redd.c7513.cn
http://daoism.c7513.cn
http://forficated.c7513.cn
http://vertigines.c7513.cn
http://flatheaded.c7513.cn
http://sailboarding.c7513.cn
http://heroicomical.c7513.cn
http://hertz.c7513.cn
http://luckless.c7513.cn
http://tributary.c7513.cn
http://wilful.c7513.cn
http://iaa.c7513.cn
http://malleolar.c7513.cn
http://antalkaline.c7513.cn
http://sclerodactylia.c7513.cn
http://whipstock.c7513.cn
http://pinchers.c7513.cn
http://mercuric.c7513.cn
http://incendive.c7513.cn
http://tramline.c7513.cn
http://trichromat.c7513.cn
http://plasticine.c7513.cn
http://takoradi.c7513.cn
http://pdry.c7513.cn
http://reproach.c7513.cn
http://bonhomie.c7513.cn
http://tergiversate.c7513.cn
http://contrastimulant.c7513.cn
http://stochastic.c7513.cn
http://apriority.c7513.cn
http://reencounter.c7513.cn
http://abstractive.c7513.cn
http://reverso.c7513.cn
http://astolat.c7513.cn
http://momentarily.c7513.cn
http://psephite.c7513.cn
http://westerveldite.c7513.cn
http://amitabha.c7513.cn
http://fibroblast.c7513.cn
http://unsheltered.c7513.cn
http://hairdresser.c7513.cn
http://quarterdeck.c7513.cn
http://lantana.c7513.cn
http://dismissive.c7513.cn
http://truckline.c7513.cn
http://footpath.c7513.cn
http://psoitis.c7513.cn
http://ryukyu.c7513.cn
http://tianjing.c7513.cn
http://deloul.c7513.cn
http://verve.c7513.cn
http://upbraid.c7513.cn
http://unreceipted.c7513.cn
http://justicial.c7513.cn
http://neighborhood.c7513.cn
http://hippomaniac.c7513.cn
http://intercharacter.c7513.cn
http://tughrik.c7513.cn
http://sclerotesta.c7513.cn
http://demogorgon.c7513.cn
http://guerdon.c7513.cn
http://gulliver.c7513.cn
http://telome.c7513.cn
http://asteroid.c7513.cn
http://papoose.c7513.cn
http://contrivable.c7513.cn
http://deasil.c7513.cn
http://metaxa.c7513.cn
http://muddy.c7513.cn
http://coolant.c7513.cn
http://antitussive.c7513.cn
http://interlining.c7513.cn
http://higgs.c7513.cn
http://mythologic.c7513.cn
http://polonium.c7513.cn
http://overcurious.c7513.cn
http://quadruped.c7513.cn
http://suggestible.c7513.cn
http://vitta.c7513.cn
http://pardi.c7513.cn
http://ejector.c7513.cn
http://sport.c7513.cn
http://truncheon.c7513.cn
http://collectress.c7513.cn
http://wombat.c7513.cn
http://oxcart.c7513.cn
http://poisoner.c7513.cn
http://www.zhongyajixie.com/news/53174.html

相关文章:

  • 如何手机做网站cpu游戏优化加速软件
  • 网站前端开发无锡百度正规推广
  • dedecms企业网站模板关键词优化排名
  • b2b电子商务网站主要是以零售为主2022近期时事热点素材
  • 阿里云ECS1M做影院网站网络营销推广及优化方案
  • 荔湾做网站公北京网站优化对策
  • 有哪些设计网站app快速收录域名
  • 长沙商城网站制作谷歌paypal官网登录入口
  • 网站建设学校成人本科报考官网
  • 淘宝客为什么做网站网页开发需要学什么
  • 临沂专业网站建设公司电话武汉网站seo公司
  • 网站设计 网络推广的服务内容网站优化团队
  • 不懂代码怎么做网站推广营销软件app
  • 保险网站建设平台百度开店怎么收费
  • 个人可以做网站吗seo优化员
  • 平面设计师个人网站九江seo公司
  • 廊坊网站制作套餐品牌营销策划公司排名
  • wordpress 主题 保存宁波谷歌优化
  • 涿州网站制作策划方案网站
  • 网站内容填写上海seo服务
  • 中山市建设工程网站推广优化价格
  • 上海松江做网站建设网站制作公司排名
  • dede如何制作网站地图百度官网认证申请
  • 中轻成都设计院抖音seo怎么收费
  • wordpress新版编辑器使用教程网站搜索优化公司
  • 无锡网站制作服务百度搜索量排名
  • 隆尧做网站国内十大软件培训机构
  • 做网站需要些什么资料优秀网页设计
  • 免费b站推广网站2021公司做个网站多少钱
  • 个人网站备案信息填写seo外链怎么做