Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: AjaxFileUpload assumes no query strings already exist in page URL on postback [27149]

$
0
0
When AjaxFileUpload post back it takes your page URL and appends onto the end of it it's own query strings (contextkey and guid). This works fine if your page URL doesn't already contain any query strings but if it does then you end up with a URL that contains two question marks which then corrupts your own final query string value and this in turn stops the upload from working.
Comments: I had this problem when page contains query string on load. This is the solution I got (for 2013 release of the control). Three functions should be changed: 1. Open AjaxFileUpload.Control.pre.js, 2. find "doneAndUploadNextFile" function and make a change: original: xhr.open("POST", "?contextKey="+ this._contextKey +"&done=1&guid=" + fileItem._id, true); changed: var queryString = window.location.search.length <= 0 ? '?' : window.location.search.valueOf() + '&'; queryString += 'contextKey=' + this._contextKey + '&done=1&guid=' + fileItem._id; xhr.open("POST", queryString, true); 3. find "onUploadOrCancelButtonClickedHandler" function and make a change: original: xhr.open("POST", '?contextKey=' + this._contextKey + "&start=1&queue=" + this._filesInQueue.length); changed: var queryString = window.location.search.length <= 0 ? '?' : window.location.search.valueOf() + '&'; queryString += 'contextKey=' + this._contextKey + '&start=1&queue=' + this._filesInQueue.length; xhr.open("POST", queryString); 4. find "done" function and make a change: original: xhr.open("POST", '?contextKey=' + this._contextKey + "&complete=1&queue=" + this._filesInQueue.length + "&uploaded=" + (this._currentQueueIndex - (currentFile._isUploaded ? 0 : 1)) + "&reason=" + (this._canceled ? "cancel" : "done")); changed: var queryString = window.location.search.length <= 0 ? '?' : window.location.search.valueOf() + '&'; queryString += 'contextKey=' + this._contextKey + '&complete=1&queue=' + this._filesInQueue.length + '&uploaded=' + (this._currentQueueIndex - (currentFile._isUploaded ? 0 : 1)) + '&reason=' + (this._canceled ? 'cancel' : 'done'); xhr.open("POST", queryString); 5. Build AjaxControlToolkit solution and upload new .dll file.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>