PDA

View Full Version : [CLOSED] Problem with downloading files in MVC 3 and ext.net 2



RCM
Aug 23, 2012, 10:12 PM
Since upgraded to MVC2 and ext.net 2. When I send the file from the controller I get a error status 200 and the file appears to be trying to open in a window,instead of giving me the save as dialog.

The controller code


public FilePathResult GetPackageFile(string packageGuid)
{
ControllerContext.HttpContext.Response.AddHeader("cache-control", "no-cache");

FilePathResult result = null;
var progressArgs = m_ProgressManager.GetStatus(packageGuid);

if (progressArgs != null && progressArgs is FilePathResult)
{
result = (FilePathResult)progressArgs;
m_ProgressManager.Remove(packageGuid);
var cd = new System.Net.Mime.ContentDisposition
{
FileName = ((FilePathResult)progressArgs).FileName,
// always prompt the user for downloading, set to true if you want
// the browser to try to show the file inline
Inline = false
};
Response.AppendHeader("Content-Disposition", cd.ToString());

}

return result;
}


and is called from a direct event call

GetPackageFile: function () {

var page = Monitor.GetActiveTabBody();
var row = page.App.PackageManagementGridPanel.selModel.getSe lection()[0];
if (!Ext.isDefined(row)) return;

Ext.net.DirectEvent.request({
buffer: 300,
isUpload: true,
cleanRequest: true,
url: "/PackageManagement/GetPackageFile?packageGuid=" + row.data.PackageGuid,
formProxyArg: "fileform2"
});
}
I am also sure the form with id fileform2 appears on the page.

4676

Vladimir
Aug 23, 2012, 10:37 PM
Please use 'formId' instead 'formProxyArg'

RCM
Aug 23, 2012, 10:53 PM
Please use 'formId' instead 'formProxyArg'

Yes that solved it. I had changed the form id once i changed it back and used formid instead it worked.

geoffrey.mcgill
Aug 24, 2012, 2:17 AM
As well, please edit your original forum post and add wrapping [CODE] tags to your code sample.