Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  177] [ 2]  / answers: 1 / hits: 34419  / 11 Years ago, fri, march 15, 2013, 12:00:00

enter



This code works in FF and chrome. In IE 8 or 9 I get a 500 error saying a not null property is null.



Here is the html



<div id=upload_button_div_general class=fileupload-buttonbar data-url=/Upload/SomeMethod>
<label class=fileinput-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary role=button>
<span class=ui-button-text>
<span>Add Documents...</span>
</span>
<input id=upload_button type=file name=postedFiles multiple= />
</label>
</div>
<div id=UploadMessage data-bind=visible: showMessage>
<span>Documents</span>

<ul data-bind=foreach: upload()>
<li>
<a href=# data-bind=click: $parent.openFile>
<span data-bind=text: $data.fileName> </span>
</a>
</li>
</ul>
</div>


Here is the javascript



function Upload(div, additionalParams, successFunc, failureFunc) {
$('#' + div).fileupload({
dataType: 'json',
url: rootPath + 'Upload/SomeMethod',
formData: additionalParams,
start: function (e, data) {
showLoading();
},
stop: function (e, data) {
hideLoading();
},
add: function (e, data) {
data.submit();
},
always: function (e, data) {
var result = data.result;
if (result.HasError) {
failureFunc(result.Error);
} else {
successFunc(result);
}
}
});
};


The controller method is



public virtual JsonResult SomeMethod(IEnumerable<HttpPostedFileBase> postedFiles, int id)

More From » jquery

 Answers
41

I was able to get it working by including jquery.iframe-transport.js and then I had to remove my knockout with data-bind from the div to get it to work in IE8 because it worked in IE9. (I had a with binding above my posted code) Thanks for all the suggestions.


[#79578] Thursday, March 14, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
irvingcarloe

Total Points: 677
Total Questions: 109
Total Answers: 96

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
irvingcarloe questions
Wed, Mar 31, 21, 00:00, 3 Years ago
Tue, Aug 4, 20, 00:00, 4 Years ago
Fri, Jul 3, 20, 00:00, 4 Years ago
;