Download file and "Valums" POST method

My problem is that the file-uploader http://valums.com/ajax-upload/ adds the URL parameters rather than passing them POST.

For instance:

 action:'/upload.php' params : { x1:'x1'} 

... will be sent as a URL:

/upload.php?x1=x1

(GET), but I need to pass additional POST parameters. Is it possible?

+6
javascript jquery file-upload
source share
1 answer

I think you are using an old version of ajax-upload. I found this new one .

Here is an example of working with OK with the data attribute correctly 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 submitting the file and got this automatically generated 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> 
+3
source share

All Articles