简体   繁体   English

以编程方式调用Plupload

[英]Invoke Plupload Programmatically

Is it possible that I could invoke plupload file upload dialog programmatically using any runtime? 是否可以使用任何运行时以编程方式调用plupload文件上传对话框?

Actually, I have a table with 9 cells. 实际上,我有一个包含9个单元格的表。 I want that when user clicks on a cell it calls upon a file upload dialog and upload an image in the same dialog. 我希望当用户单击单元格时,它会调用文件上传对话框,并在同一对话框中上传图像。

Is it possible through Plupload? 是否可以通过Plupload?

You can invoke plupload programmatically client side, and even have several uploaders on your page. 您可以通过编程方式在客户端调用plupload,甚至在页面上也可以有多个上传器。

A way to do it : 一种方法:

  • having 9 invisible div containers with ids pludiv1, ... , pludiv9. 具有9个不可见的div容器,其ID为pludiv1,...,pludiv9。 They will contain your uploaders 他们将包含您的上传者
  • embed all your plupload initialization code in a pluploadInit function that takes an id as a parameter. 将所有的plupload初始化代码嵌入到以id为参数的pluploadInit函数中。 In the function, you will use this id to retrieve the div and init the uploader inside it. 在该函数中,您将使用此ID检索div并初始化其中的上载器。
  • upon click on buttonX, show pludivX first(important), and invoke pluploadInit with "pludivX" as a parameter. 在单击buttonX时,首先显示pludivX(重要),然后使用“ pludivX”作为参数调用pluploadInit。

As you will have several uploaders, pay attention to their contexts. 由于您将有多个上载器,因此请注意其上下文。 For example, you will have to add some extra parameter to identify the button-uploader in your post request to the server. 例如,您将必须添加一些额外的参数来标识对服务器的发布请求中的按钮上载器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM