[英]“Valums” file uploader and method POST
My problem is that the file-uploader http://valums.com/ajax-upload/
adds params to the URL instead of passing them by POST. 我的问题是文件上传器
http://valums.com/ajax-upload/
将params添加到URL而不是通过POST传递它们。
For example: 例如:
action:'/upload.php'
params : { x1:'x1'}
... will submit as the URL: ...将作为网址提交:
/upload.php?x1=x1
/upload.php?x1=x1
(GET), but I need to pass additional params by POST. (GET),但我需要通过POST传递额外的参数。 Is this possible?
这可能吗?
I think you're using an old version of ajax-upload. 我想你正在使用旧版本的ajax-upload。 I found this new one .
我发现了这个新的 。
Here's an example of it working OK with a data
attribute properly converted to hidden input fields: http://jsfiddle.net/marcosfromero/XkCP5/ 这是一个正常工作的例子,
data
属性正确转换为隐藏的输入字段: http : //jsfiddle.net/marcosfromero/XkCP5/
var button = $('#button1'), interval;
new AjaxUpload(button,{
//action: 'upload-test.php', // I disabled uploads in this example for security reasons
action: 'upload.htm',
--> data: {field1: 'value1', field2: 'value2'}, <--
...
I stopped the submission of the file and got this automatically created form: 我停止了文件的提交,并自动创建了这个表单:
<form enctype="multipart/form-data" method="post" style="display: none;" action="upload.htm" target="ValumsAjaxUpload0">
<input type="hidden" name="field1" value="value1">
<input type="hidden" name="field2" value="value2">
<input type="file" name="myfile" style="position: absolute; margin: -5px 0pt 0pt -175px; padding: 0pt; width: 220px; height: 30px; font-size: 14px; opacity: 0; cursor: pointer; display: block; z-index: 2147483583; top: 48px; left: 147px;">
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.