Click here to Skip to main content
15,917,617 members
Home / Discussions / C#
   

C#

 
GeneralC# UserControl Pin
markjuggles24-Aug-04 11:20
markjuggles24-Aug-04 11:20 
GeneralRe: C# UserControl Pin
Nick Parker24-Aug-04 11:32
protectorNick Parker24-Aug-04 11:32 
GeneralRe: C# UserControl Pin
Charlie Williams24-Aug-04 11:52
Charlie Williams24-Aug-04 11:52 
GeneralRe: C# UserControl Pin
markjuggles24-Aug-04 14:27
markjuggles24-Aug-04 14:27 
QuestionC# - How to Zip file on the Web Server? Pin
HyVong24-Aug-04 9:45
HyVong24-Aug-04 9:45 
AnswerRe: C# - How to Zip file on the Web Server? Pin
Not Active24-Aug-04 9:52
mentorNot Active24-Aug-04 9:52 
GeneralRe: C# - How to Zip file on the Web Server? Pin
Heath Stewart24-Aug-04 10:46
protectorHeath Stewart24-Aug-04 10:46 
GeneralRe: C# - How to Zip file on the Web Server? Pin
HyVong26-Aug-04 4:38
HyVong26-Aug-04 4:38 
using java.util.zip;
using java.io;
..
..
i created method to zip the file based on the codes have given.
<br />
private void ZipFile(string fileName, string ExpType)<br />
{<br />
        string extType = "zip";<br />
        string zipFileName = fileName + "." + extType; <br />
        string soureFileName = fileName + "." + ExpType;<br />
<br />
	// Output stream <br />
        // ONCE IT RUNS THIS LINE, IT GIVES ME THE ERROR<br />
        // SAYS 'ACCESS IS DENIED.'<br />
	FileOutputStream fos = new FileOutputStream(zipFileName); <br />
<br />
	// Tie to zip stream <br />
	ZipOutputStream zos = new ZipOutputStream(fos); <br />
<br />
	// Stream with source file <br />
	FileInputStream fis = new FileInputStream(soureFileName); <br />
<br />
	// It's our entry in zip <br />
	ZipEntry ze = new ZipEntry(soureFileName); <br />
<br />
	zos.putNextEntry(ze); <br />
	sbyte[] buffer = new sbyte[1024]; <br />
	int len; <br />
<br />
	// Read and write until done <br />
	while((len = fis.read(buffer)) >= 0) <br />
	{ <br />
		zos.write(buffer, 0, len); <br />
	}<br />
 <br />
	// Close everything <br />
	zos.closeEntry(); <br />
	fis.close(); <br />
	zos.close(); <br />
	fos.close();<br />
}<br />

I have the folder that held the file temporary has full access for users.
I don't know if i have to give the path for it to be able to zip too? Please help, i have no clue why it says access is denied. And is the code above correct?
I haven't had a chance to test the whole codes since the first line had some error. hope to hear from everyone soon. thank you so much.Frown | :(

*HyVong*

oh and when i tried to delete the file after it's being zipped, but i can't, 'File' is an ambiguous reference, how do i delete the file after being zipped?
File.Delete(Server.MapPath(@"~\import\\" + soureFileName));

Thanx so much for all your help.
GeneralRe: C# - How to Zip file on the Web Server? Pin
HyVong26-Aug-04 5:36
HyVong26-Aug-04 5:36 
AnswerRe: C# - How to Zip file on the Web Server? Pin
Anonymous24-Aug-04 10:03
Anonymous24-Aug-04 10:03 
AnswerRe: C# - How to Zip file on the Web Server? Pin
Nick Parker24-Aug-04 10:38
protectorNick Parker24-Aug-04 10:38 
AnswerRe: C# - How to Zip file on the Web Server? Pin
HyVong26-Aug-04 5:38
HyVong26-Aug-04 5:38 
GeneralIntegrating C++ and C# code Pin
crushinghellhammer24-Aug-04 6:58
crushinghellhammer24-Aug-04 6:58 
GeneralRe: Integrating C++ and C# code Pin
Steve Maier24-Aug-04 7:22
professionalSteve Maier24-Aug-04 7:22 
GeneralRe: Integrating C++ and C# code Pin
Heath Stewart24-Aug-04 7:57
protectorHeath Stewart24-Aug-04 7:57 
GeneralRe: Integrating C++ and C# code Pin
Nick Parker24-Aug-04 7:34
protectorNick Parker24-Aug-04 7:34 
GeneralRe: Integrating C++ and C# code Pin
crushinghellhammer24-Aug-04 8:13
crushinghellhammer24-Aug-04 8:13 
GeneralRe: Integrating C++ and C# code Pin
Heath Stewart24-Aug-04 9:05
protectorHeath Stewart24-Aug-04 9:05 
GeneralRe: Integrating C++ and C# code Pin
crushinghellhammer24-Aug-04 9:21
crushinghellhammer24-Aug-04 9:21 
GeneralRe: Integrating C++ and C# code Pin
Heath Stewart24-Aug-04 10:27
protectorHeath Stewart24-Aug-04 10:27 
GeneralRe: Integrating C++ and C# code Pin
crushinghellhammer24-Aug-04 11:59
crushinghellhammer24-Aug-04 11:59 
GeneralRe: Integrating C++ and C# code Pin
Heath Stewart24-Aug-04 16:12
protectorHeath Stewart24-Aug-04 16:12 
GeneralRe: Integrating C++ and C# code Pin
Tom Larsen24-Aug-04 11:19
Tom Larsen24-Aug-04 11:19 
GeneralSimple Reflenction Pin
afronaut24-Aug-04 6:24
afronaut24-Aug-04 6:24 
GeneralRe: Simple Reflenction Pin
Charlie Williams24-Aug-04 7:25
Charlie Williams24-Aug-04 7:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.