I'm using the MVC Upload control under MVC 3.0(Razor) with the following code. This has been tested fine for FF 4.0+, Chrome 11.0+, 8 and 9. IE 7 (in IE9 developer mode) however sends a null file to the controller (JobController\Save). I've attached the relevant view upload code and server side controller code.
Has anyone else seen this problem?
Cheers,
Sebastian
@(Html.Telerik().Upload() .Name("files") .Multiple(true) .Async(async => async .Save("Save", "Job") .AutoUpload(true) ) .ClientEvents(events => events .OnComplete("onUploadComplete")) ) <script type="text/javascript"> function onUploadComplete(e) { $('.t-upload-files').remove(); refreshCurrent(); } </script>[HttpPost] public ActionResult Save(IEnumerable<HttpPostedFileBase> files) { var token = LoginToken.FromSession; if (token != null) { if (files != null) { // The Name of the Upload component is "attachments" foreach (var file in files) { if (file.ContentLength > 0) token.Submit(file); } } else Logger.logError("Failed to upload files."); } // Return an empty string to signify success return Content(""); }
12 Answers, 1 is accepted
I tried to reproduce the problem, but without success. I have a hunch that removing the ".t-upload-files" list might have to do with that.
Do you experience the same problem if you remove the OnComplete handler?
Tsvetomir Tsonev
the Telerik team
When I create a simple test project with just the telerik file uploader it works fine for IE7.
I've updated the code to:
@(Html.Telerik().Upload() .Name("files") .Multiple(true) .ShowFileList(false) .Async(async => async .Save("Save", "Job") .AutoUpload(true) ) .ClientEvents(events => events .OnComplete("onUploadComplete")) ) <script type="text/javascript"> $(function () { var uploadButton = $('.t-upload-button'); if (uploadButton.hasClass('t-button')) uploadButton.removeClass('t-button'); uploadButton.addClass('button buttonGreen'); uploadButton.width(380); var btnTxt = $('span', uploadButton); if ($.browser.msie) btnTxt.text('@Resources.Global.UploadFileIE'); else btnTxt.text('@Resources.Global.UploadFile'); }); function onUploadComplete(e) { refreshCurrent(); } </script>
This now works for IE 6 but IE 7 still has post back a null file. I've tried removing all the custom javascript and still get the same issue. The posted files are returned as null.
The real view is loaded via ajax into a jquery tab. I'm not sure if there are know issue with this.
Cheers,
Sebastian
Cheers,
Sebastian
We're seeing this on one particular machine with IE 9 (windows 7). Uploading from this machine results in an empty server being received server side. Using Chrome/Firefox on this machine is fine. Uploading with IE 9 from a different client machine works properly!
We're trying to find out what the issue is.
Accessing the WebPrint server via the IP address seems to resolve the problem. Accessing it via the machine name does not work properly under IE (works fine with other browsers). The firewall has been turned off.
Below is part of the failed request (from NetworkData.xml) from IE9 developer mode :
<browser>
<name>Internet Explorer</name>
<version>9.0.8112.16421</version>
</browser>
<pages>
<page>
<startedDateTime>2011-08-29T22:45:09.927+12:00</startedDateTime>
<id>0</id>
<title/>
<pageTimings>
<onContentLoad>-1</onContentLoad>
<onLoad>-1</onLoad>
</pageTimings>
</page>
</pages>
<entry>
<pageref>0</pageref>
<startedDateTime>2011-08-29T22:45:12.173+12:00</startedDateTime>
<time>234</time>
<request>
<method>POST</method>
<url>http://pb-s2003-32/Supervisor/WebPrint/Job/Save</url>
<httpVersion>HTTP/1.1</httpVersion>
<cookies>
<cookie>
<name>L</name>
<value>1</value>
</cookie>
<cookie>
<name>X</name>
<value>tvecx3efxallr51j2k3rvzkl</value>
</cookie>
<cookie>
<name>WPX</name>
<value>A80479E203DFFE5CC56FEEBE78E439DDEC7773A6F44FE780451F7DAFF30703BE281AB06D13000244C07F1BC9B873DA152A1711DA3D2E5EEC18234B6180BF6ACDC564BCED23F9D684741AB1BAFB5657A418D0E4641E5279D90D8F6E4D4E8AA8F5C3210404E743D20B455BA6DF8572548440924B74CE737DE0900D60630D2BA135AF486FC1A250811353246100A69FAC38</value>
</cookie>
<cookie>
<name>C1</name>
<value>1</value>
</cookie>
<cookie>
<name>D1</name>
<value>false</value>
</cookie>
</cookies>
<headers>
<header>
<name>Accept</name>
<value>application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*</value>
</header>
<header>
<name>Referer</name>
<value>http://pb-s2003-32/Supervisor/WebPrint/</value>
</header>
<header>
<name>Accept-Language</name>
<value>en-NZ</value>
</header>
<header>
<name>User-Agent</name>
<value>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C)</value>
</header>
<header>
<name>Content-Type</name>
<value>multipart/form-data; boundary=---------------------------7dbaec80d9e</value>
</header>
<header>
<name>Accept-Encoding</name>
<value>gzip, deflate</value>
</header>
<header>
<name>Host</name>
<value>pb-s2003-32</value>
</header>
<header>
<name>Content-Length</name>
<value>233899</value>
</header>
<header>
<name>Connection</name>
<value>Keep-Alive</value>
</header>
<header>
<name>Cache-Control</name>
<value>no-cache</value>
</header>
<header>
<name>Cookie</name>
<value>L=1; X=tvecx3efxallr51j2k3rvzkl; WPX=A80479E203DFFE5CC56FEEBE78E439DDEC7773A6F44FE780451F7DAFF30703BE281AB06D13000244C07F1BC9B873DA152A1711DA3D2E5EEC18234B6180BF6ACDC564BCED23F9D684741AB1BAFB5657A418D0E4641E5279D90D8F6E4D4E8AA8F5C3210404E743D20B455BA6DF8572548440924B74CE737DE0900D60630D2BA135AF486FC1A250811353246100A69FAC38; C1=1; D1=false</value>
</header>
</headers>
<queryString/>
<postData>
<mimeType>multipart/form-data</mimeType>
<params>
<param>
<name/>
<filename>C:\Users\randy\Desktop\SuperVisor Net configuration.xps</filename>
<contentType>application/vnd.ms-xpsdocument</contentType>
</param>
</params>
</postData>
<headersSize>1152</headersSize>
<bodySize>233899</bodySize>
</request>
<response>
<status>200</status>
<statusText>OK</statusText>
<httpVersion>HTTP/1.1</httpVersion>
<cookies/>
<headers>
<header>
<name>Date</name>
<value>Mon, 29 Aug 2011 22:45:48 GMT</value>
</header>
<header>
<name>Server</name>
<value>Microsoft-IIS/6.0</value>
</header>
<header>
<name>X-Powered-By</name>
<value>ASP.NET</value>
</header>
<header>
<name>X-AspNet-Version</name>
<value>4.0.30319</value>
</header>
<header>
<name>X-AspNetMvc-Version</name>
<value>3.0</value>
</header>
<header>
<name>Cache-Control</name>
<value>private, s-maxage=0</value>
</header>
<header>
<name>Content-Type</name>
<value>text/html; charset=utf-8</value>
</header>
<header>
<name>Content-Length</name>
<value>23</value>
</header>
</headers>
<content>
<size>23</size>
<mimeType>text/html; charset=utf-8</mimeType>
<text>Submitted List is empty</text>
</content>
<redirectionURL/>
<headersSize>257</headersSize>
<bodySize>23</bodySize>
</response>
<cache/>
<timings>
<send>0</send>
<wait>234</wait>
<receive>0</receive>
</timings>
</entry>
This is quite interesting. Do you mind capturing one successful (via IP address) and one failing session (via hostname) using Fiddler/FiddlerCap?
It should provide us with more details than the IE9 capture.
Tsvetomir Tsonev
the Telerik team
The requested FiddlerCap are as attached.
Regards,
Sebastian
The failed requests seem to be missing the upload name field. We've recently fixed an issue that could lead to such problem.
Please try upgrading to the attached build to see if that helps.
Tsvetomir Tsonev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
I've updated our project accordingly to (2011.2.830). Both uploading via IP-address and machine name fails. I've also noticed that the IE7 compatibility mode under IE 9 is on for the QA machine (setting this to IE 9 mode resolves the problem). Our QA guys reported seeing this in IE 8 as well.
Regards,
Sebastian
We were finally able to reproduce the issue after upgrading to jQuery 1.6.2
We'll file a bug report with jQuery, but for the moment we've fixed the problem in our code. I'm sending you an updated build.
As a token of gratitude for your involvement your Telerik points have been updated.
Tsvetomir Tsonev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Cheers,
Sebastian