Solved

file upload results in download window in firefox and IE

Posted on 2009-05-06
7
234 Views
Last Modified: 2012-05-06
I am using this jquery code:

var options =
                {
                    url: '../Account/Upload',
                    type: 'POST',
                    contentType: 'multipart/form-data',
                    dataType: "text",
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        ...
                    },
                    success: function(data) {
                        ...
                    },
                    beforeSend: function() {
                        ...
                    },
                    semantic: false
                };

            // bind form using 'ajaxForm'
            $('#item_form').ajaxForm(options);

to upload files to the server, which works fine. I am using the forms plugin and the multifile upload plugin. I believe that the former plugin uses the 'iframe approach' to allow file upload. Unfortunately, I get file download popups in my browsers (tried firefox and IE) after the upload. E.g. firefox "You have chosen to open ...". I believe this has to do with the iframe stuff. Is there a way to avoid these pop ups?

Thanks.

Best wishes,

Christian
0
Comment
Question by:csetzkorn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 

Author Comment

by:csetzkorn
ID: 24325752
Thanks for that. Do you know how to change the headers to be
content type HTML (as mentioned in this article)?

Thanks.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24325854
What is your server language? PHP/ASP/.NET?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:csetzkorn
ID: 24325893
I am using ASP.NET MVC

code:

[AcceptVerbs(HttpVerbs.Post)]
        public JsonResult Upload
        (
            HttpPostedFileBase file
)
{
 // save files works fine
}
0
 

Author Comment

by:csetzkorn
ID: 24326013
This is what I get in Firefox after the upload - something similar occurs in IE.

I have also noticed that I can only retrieve the other standard form elements on the server side if the user chooses at least one file. Not sure why. The JSON data are send either way (detected via Firebug).

C
untitled.JPG
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24326082
0
 

Author Comment

by:csetzkorn
ID: 24326550
Thanks. It was actually easier than that:

AcceptVerbs(HttpVerbs.Post)]
        public string Upload
        (
            HttpPostedFileBase file
)
{
 // save files works fine
}
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question