Solved

file upload results in download window in firefox and IE

Posted on 2009-05-06
7
218 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now