GithubHelp home page GithubHelp logo

form-upload's Issues

请问上传的时候有办法指定文件存储的后缀吗

之前看到有朋友讨论说可能会加这样的魔法变量,请问现在有了吗,看文档里还没有呢
因为文件上传后,文件名肯定是唯一的,我这不前端不希望再去弄套规则生成唯一文件名了,如果能直接传一个文件后缀就好了,或者说不传key默认就是上传文件的后缀名就好了 : )

please add jsonp callback parameter

<iframe id='callback-iframe'  src='/callback.html' frameborder='0' width='0' height='0'></iframe>
<form method="post" action="http://up.qiniu.com/" enctype="multipart/form-data" target='callback-iframe'>
  <input name="key" type="hidden" value="<Your file name in qiniu>">
  <input name="x:<custom_field_name>" type="hidden" value="<Value of your custom param>">
  <input name="token" type="hidden" value="<Your uptoken from server>">
  <input name="file" type="file"/>
 <input name="jsonp" type="hidden" value="<custom javascript function name>">
</form>

低级浏览器不支持ajax上传文件时,要用iframe来做无刷新处理,此时如果七牛api支持JSONP格式应答,可以把key和hash及其他应答传递给用户自定义的jsonp callback函数。

预期应答如下:

Content-Type : application/javascript

body:  
xyzJavascriptCallbackFunction({ /*xyzJavascriptCallbackFunction is the jsonp parameter's value*/
   'key' : 'adhsaljfhdlskf',
   'hash' : 'shflsdfhldshflsd'
   //,.....
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.