Skip to Content
author's profile photo Former Member
Former Member

zip download CRC error javascript

zip download CRC error javascript

Hello xperts, i am trying to develop a jsp page containing a javascript code which should download a zip file, i have a script that works fine for this as a separated part ,but when i intgegrate this code to anoter, it download the .zip file corrupted

the separated code is as follows:

Should i fix anything in this individual code?

Tanx in advance!!

String ubicacion="";

String packzip="fileone.zip";

ubicacion="C:
"+packzip;

response.setContentType("application/zip");

response.addHeader("Content-Disposition", "attachment; filename="+packzip);

try{

File Zarchivo= new File(ubicacion);

int TamZarch=(int)Zarchivo.length();

FileInputStream fEnt = new FileInputStream(Zarchivo);

PrintWriter Mnsj = response.getWriter();

int c=-1;

while ((c = fEnt.read()) != -1){

Mnsj.print((char)c);

}

fEnt.close();

Mnsj.flush();

Mnsj=null;

}catch(Exception e){

}

%>

Finally i send the java script code (sdn page cannot save this part but it consists on the following steps:)

settting window pop up name

setting window parameters

opening the file

setting timeout to 5000 ms

closing window

Edited by: NWrscr on Aug 21, 2011 11:35 PM

Edited by: NWrscr on Aug 21, 2011 11:39 PM

Edited by: NWrscr on Aug 22, 2011 12:42 AM

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 26, 2011 at 03:42 AM

    Done

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.