This is a migrated thread and some comments may be shown as answers.

[Solved] Receiving metadata from the upload action Opera issue

3 Answers 21 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kyle
Top achievements
Rank 1
Kyle asked on 06 Mar 2012, 03:10 PM
I am attempting to use the Upload control to allow my users to upload pictures and/or videos. When the picture/video is uploaded to the server it is given a unique ID and a URL. I am attempting to pass the ID and URL back up to the JavaScript so that I can add the picture/video to the page without having to refresh the entire page. How I am doing this is by simply adding the URL and ID of the pictures and videos to the return Json object in my action like so:

return Json(new { status = "OK", photoInfo = PhotoURLs, videoInfo = VideoURLs }, "text/plain");

PhotoURLs and VIdeoURLs are strings of their respective URLs and IDs. I then attach a listener to the "onSuccess" event like so:
$(".uploadWrapper .t-upload").on("onSuccess", function (event, e) {
 
I then drill down into the e.response to get e.response.photoInfo and e.response.videoInfo and parse through them to split out the URLs and IDs and then use JQuerys .append method to append the objects to the document thus making them appear on the page without having to refresh the page. 

The problem occurs when I try to do this in Opera. e.response is always null and I found that as an alternative you could use e.XMLHttpRequest.responseText but this is always "". (e.XMLHttpRequest also contains status and statusText). I can see the JSON object being pass properly in Fiddler but for some reason when it makes it to Opera it is emptied out. This works properly in all other modern browsers so this leads me to believe that it might be something to do with Opera.

Here is my setup:
OS: Windows 7 64-bit
Opera version 11.61 Build 1250
.NET 4
MVC 3

Thanks in advance for any assistance.

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 07 Mar 2012, 10:41 AM
Hi,

Thank you for the detailed explanation of the problem.

I did a simple test by modifying one of our demos and it appears to work fine. My first guess is that Opera is treating the request as cross-domain and is blocking the access to the IFRAME containing the response. What is the URL of the page and the download handler in your scenario?

It would be great if you can record the session traffic using Fiddler. This would allow us to inspect the actual requests and reproduce the problem.

Regards,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Kyle
Top achievements
Rank 1
answered on 07 Mar 2012, 02:07 PM
After further debugging I discovered that the issue is related to Operas DOM inspector (Dragonfly). If the inspector is open the e.response is always null however if I close the inspector everything comes in as it should. Not entirely sure how or why a DOM inspector would cause such an issue but that appears to be the issue.

Thank you for your time.
0
Accepted
T. Tsonev
Telerik team
answered on 07 Mar 2012, 03:20 PM
Hello,

I can't believe I've missed that one. Anyway, all is good when it ends well.

Kind regards,
Tsvetomir Tsonev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Upload
Asked by
Kyle
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or