Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 28, 2010 04:28 PM by arun_88
0 Points
18 Posts
Oct 27, 2010 03:33 AM|LINK
Hi All,
I have ajaxified grid having 2 columns i.e FileName & Download.
When user click the Download link, the zip file gets downloaded locally.
But when i try to open (unzip) that file, i get an error message "cannot open file: it does not appear to be a valid archive"
When i remove the ajax setting completely, then i am able to unzip the file.
I am downloading the files from shared location of another server.
My Code for file:
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Download" HeaderText="AVAILABLE FILES"
Text="Download" UniqueName="FILEPATH">
<HeaderStyle Width="50px" Font-Size="10pt" Font-Bold="true" Font-Names="Arial" BorderWidth="1px"
ForeColor="White" />
<ItemStyle Height="30px" />
</telerik:GridButtonColumn>
---------------------------------/////-----------------------------------------------------------------------------------------------
.CS file:
string filePath = item["FILEPATH"].Text;
//SPSite site = SPContext.Current.Site;
SPSite site = new SPSite("http://sharepoint:000/");
{
SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates = true;
site.AllowUnsafeUpdates = true;
SPSecurity.RunWithElevatedPrivileges(delegate()
//-----------------------------------------------
string filename = Path.GetFileName(filePath);
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/zip";
Response.AppendHeader("content-disposition", "attachment; filename=" + filename);
try
Response.TransmitFile(filePath);
Response.Flush();
Response.End();
}
catch (Exception ed)
string h = ed.Message;
});
ajax
All-Star
65619 Points
11118 Posts
Oct 28, 2010 02:57 AM|LINK
This error can happen when part of the zip file becomes corrupt during an interrupted download, copy or move.
http://support.microsoft.com/kb/841120
http://www.ziprepair.com/cannot-open-file-valid-archive.php
Member
211 Points
111 Posts
Oct 28, 2010 08:55 AM|LINK
well, try removing Response.End(); from your code for the start, it has no use anyway
44 Points
7 Posts
Oct 28, 2010 09:15 AM|LINK
Hi Arun,
The Problem ight be related to the dll which you are using.
Try inserting new dll.
Oct 28, 2010 04:28 PM|LINK
Thanx for help, the issue was with given above code...
arun_88
0 Points
18 Posts
Ajax issue when try to unzip the downloaded file
Oct 27, 2010 03:33 AM|LINK
Hi All,
I have ajaxified grid having 2 columns i.e FileName & Download.
When user click the Download link, the zip file gets downloaded locally.
But when i try to open (unzip) that file, i get an error message "cannot open file: it does not appear to be a valid archive"
When i remove the ajax setting completely, then i am able to unzip the file.
I am downloading the files from shared location of another server.
My Code for file:
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Download" HeaderText="AVAILABLE FILES"
Text="Download" UniqueName="FILEPATH">
<HeaderStyle Width="50px" Font-Size="10pt" Font-Bold="true" Font-Names="Arial" BorderWidth="1px"
ForeColor="White" />
<ItemStyle Height="30px" />
</telerik:GridButtonColumn>
---------------------------------/////-----------------------------------------------------------------------------------------------
.CS file:
string filePath = item["FILEPATH"].Text;
//SPSite site = SPContext.Current.Site;
SPSite site = new SPSite("http://sharepoint:000/");
{
SPWeb web = site.OpenWeb();
{
web.AllowUnsafeUpdates = true;
site.AllowUnsafeUpdates = true;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
//-----------------------------------------------
string filename = Path.GetFileName(filePath);
Response.ClearContent();
Response.Clear();
Response.ContentType = "application/zip";
Response.AppendHeader("content-disposition", "attachment; filename=" + filename);
try
{
Response.TransmitFile(filePath);
Response.Flush();
Response.End();
}
catch (Exception ed)
{
string h = ed.Message;
}
});
}
}
ajax
chetan.sarod...
All-Star
65619 Points
11118 Posts
Re: Ajax issue when try to unzip the downloaded file
Oct 28, 2010 02:57 AM|LINK
This error can happen when part of the zip file becomes corrupt during an interrupted download, copy or move.
http://support.microsoft.com/kb/841120
http://www.ziprepair.com/cannot-open-file-valid-archive.php
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
Maniak7
Member
211 Points
111 Posts
Re: Ajax issue when try to unzip the downloaded file
Oct 28, 2010 08:55 AM|LINK
well, try removing Response.End(); from your code for the start, it has no use anyway
GirishDJ
Member
44 Points
7 Posts
Re: Ajax issue when try to unzip the downloaded file
Oct 28, 2010 09:15 AM|LINK
Hi Arun,
The Problem ight be related to the dll which you are using.
Try inserting new dll.
Software Consultant
arun_88
0 Points
18 Posts
Re: Ajax issue when try to unzip the downloaded file
Oct 28, 2010 04:28 PM|LINK
Hi All,
Thanx for help, the issue was with given above code...