Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

关于上传文件域和参数 #117

Closed
majinhui04 opened this issue Feb 27, 2014 · 8 comments
Closed

关于上传文件域和参数 #117

majinhui04 opened this issue Feb 27, 2014 · 8 comments

Comments

@majinhui04
Copy link

1.请问如何在上传的时候添加多个参数一并发送到后台?
2.可不可以添加参数 修改 file 的name 用来后台接收

@2betop
Copy link
Contributor

2betop commented Feb 27, 2014

options里面还有几个参数没有说明清楚,不好意思。

  • options.formdata: {xxx: xxx}用来控制全局的附带参数。
    如果要分开控制每个文件的,也就是说每个文件附带参数不一样的话需要这么做
uploader.on('uploadBeforeSend', function(obj, data ) {
      data.xxx = xxx;  // 扩展data对象,就会作为附带参数发过去
});
  • options.fileVar: 'file', 用来控制file的name.

@majinhui04
Copy link
Author

测试通过 thanks~~

@2betop 2betop closed this as completed Apr 2, 2014
@litterGuy
Copy link

请教一下 为什么通过formdata向后台传值在后台获取不到?

@2betop
Copy link
Contributor

2betop commented Apr 22, 2014

@litterGuy 请移步到这个issue: #145

@michaelong
Copy link

能说明一下吗,我还是不了解,有人能分享吗?[email protected]

@ZheCheng
Copy link

@2betop 您好 我后台需要自定义一个type参数 我写在fromdata里面,但是它会被默认替换成文件的类型 怎么办 能不能默认不发文件类型
-----------------------------7815454723765
Content-Disposition: form-data; name="type"

image/jpeg我需要自定义

@iamziyue
Copy link

iamziyue commented Dec 23, 2016

@2betop

options.fileVar: 'file', 用来控制file的name.

文档中是fileVal,但是设置不成功,像这样的:fileVal:'upload',,最后渲染出来总是name="file"这个默认值

@940935011
Copy link

有两套系统,其中一套是文件资源管理,专门管理文件的,另一个是商品系统,现在要做的是从商品系统中跨域把图片上传到文件资源管理系统,但是上传失败!!

POST http://127.0.0.1:9083/yzl-image/image/upload/file

webuploader.js (第 6810 行)
"NetworkError: 403 Forbidden - http://127.0.0.1:9083/yzl-image/image/upload/file"
file
已阻止跨源请求:同源策略禁止读取位于 http://127.0.0.1:9083/yzl-image/image/upload/file 的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants