Plupload Upload +同步表单问题 [英] Plupload Upload + Synchronous form question

查看:189
本文介绍了Plupload Upload +同步表单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个传统表单的设置,使用 jQuery Tools验证器进行检查并提交通过POST。我喜欢这个类不需要额外的类名或其他多余的元数据来验证,标准的HTML5属性就足够了。

I have a setup with a traditional form that's checked with jQuery Tools validator and submitted via POST. I like that this class does not require extra classnames or other superfluous metadata to validate, standard HTML5 attributes are enough.

我现在想用 Plupload 上传解决方案。我知道现在所有的现代上传解决方案都是通过Ajax工作的,所以我在想一个用户填写表单,将文件放入上传队列然后提交表单的设置。表单提交意味着:

I now would like to extend this functionality with the Plupload upload solution. I know that all modern upload solutions work via Ajax these days, so I was thinking about a setup in which the user fills out the form, puts files in the upload queue and then submits the form. The form submit would imply:


  1. 通过jQuery Tools Validator进行验证...

  2. 如果经过验证,上传队列中的所有文件...(到临时文件夹)

  3. 如果上传顺利,请通过POST实际提交表单并将文件从临时文件夹移动到永久文件夹。

我在上传时有类似的设置,其中文件名在成功上传后附加到隐藏的输入字段中。在提交表单时,我因此通过$ _POST获得了所有文件名。但是,jQuery Tools Validator和Uploadify之间存在冲突。这就是为什么我现在正在研究Plupload。

I had a similar setup in place with Uploadify, where the filenames where appended into a hidden input field after succesful upload. On submit of the form, I thus had all filenames via $_POST. However, there were conflicts between jQuery Tools Validator and Uploadify. That's why I'm now looking into Plupload.

我的问题?


  1. 您如何看待这种设置?这是一个好策略吗?

  2. 我将如何在技术层面上实现这一目标?

谢谢。

推荐答案

我找到了答案。 Plupload内置了这个非常好的功能。它被设计为适合现有的形式。它使用AJAX上传文件,但在同步发布表单之前返回上传结果。这样,在发布富含Plupload的表单时,您还可以在POST变量中获得上传结果。

I've found the answer. Plupload has this very nice functionality built in. It is designed to fit into an existing form. It uses AJAX to upload the files, but it returns the results of the upload before posting the form synchronously. This way, on posting a form enriched with Plupload, you also have the result of the upload in your POST variables.

文档中并不是很清楚,但是在您从示例中提交示例表单后,它声明:

It isn't really clear in the documentation, but after you submit a sample form from the examples, it states:

上传与您可能习惯的有点不同,文件上传到临时文件夹,然后提交表单时,您将获得将文件移动到正确位置所需的所有信息。这样设计可以更容易地将其应用到现有表单。低级核心API支持这两种方法。

"Uploading is a bit different than you might be used to, files are uploaded to the temp folder, then when the form is submitted you get all the info you need to move around the files to the correct location. It's designed this way to make it easier to just apply it to an existing form. The low level core API has support for both methods."

非常好的上传解决方案。这里和那里有一些小问题,但我确定PEBKAC

Very nice upload solution. Some minor issues here and there, but I'm sure PEBKAC

这篇关于Plupload Upload +同步表单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆