My problem is that the file-uploader http://valums.com/ajax-upload/
adds params to the URL instead of passing them by POST.
For example:
action:'/upload.php'
params : { x1:'x1'}
... will submit as the URL:
/upload.php?x1=x1
(GET), but I need to pass additional params by POST. Is this possible?
I think you're using an old version of 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/
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With