Solved

file upload results in download window in firefox and IE

Posted on 2009-05-06
7
227 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
 
LVL 7

Expert Comment

by:ycTIN
ID: 24323503
0
 

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…

756 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