Home  >  Article  >  Backend Development  >  javascript - 怎么将用户本地图片用form提交上传到七牛

javascript - 怎么将用户本地图片用form提交上传到七牛

WBOY
WBOYOriginal
2016-06-06 20:12:41864browse

就是form提交本地文件到七牛,如果直接把文件路径写清楚,就可以,。如果用查了下,好像是浏览器不支持获取用户文件路径造成的,,,可我看了七牛网上示例又可以。。。我要怎么解决

我现在不管是form提交,还是异步ajax提交,都是碰到

获取的路径都是:c:\fakepath\xxxx.png

http://jssdk.demo.qiniu.io/
这例子代码和源码下载提供的不一样。

回复内容:

就是form提交本地文件到七牛,如果直接把文件路径写清楚,就可以,。如果用查了下,好像是浏览器不支持获取用户文件路径造成的,,,可我看了七牛网上示例又可以。。。我要怎么解决

我现在不管是form提交,还是异步ajax提交,都是碰到

获取的路径都是:c:\fakepath\xxxx.png

http://jssdk.demo.qiniu.io/
这例子代码和源码下载提供的不一样。

直接form上传是

<code><form method="post" action="http://upload.qiniu.com/" enctype="multipart/form-data">
  <input name="key" type="hidden" value="<resource_key>">
  <input name="x:<custom_name>" type="hidden" value="<custom_value>">
  <input name="token" type="hidden" value="<upload_token>">
  <input name="file" type="file">
  <input name="crc32" type="hidden">
  <input name="accept" type="hidden">
</form></code>

http://jssdk.demo.qiniu.io/ 这个是js sdk 用js已经封装好的

没看懂想干嘛

你是想form提交到qiniu,过程中获取用户选择的图片在本机的绝对路径?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn