Gallery app with Zip file upload

M

mc

I'm creating a gallery app, I would like users to be able to upload a
zip file (containing images) which I then unpack and and store in a
gallery for online review.

Do I need a third party component or can it be done in c# alone?

TIA

MC
 
G

Guest

You cannot do it in C# alone because the System.IO.Compression namespace
doesn't support the multiple file with zipheader zip format (like Winzip) -
only Gzip.

However, you can get the free ICSharpCode.SharpZipLib library which is 100%
C#, and that will handle zip files very nicely.

Peter
 
M

mc

I probably should have said in my initial post, the "Live" site will be
run from a shared server, so I'd like to avoid third party components if
possible!
 
R

Rad [Visual C# MVP]

I very much doubt using SharpZipLib will be a problem. It will just be
a DLL you reference in your application and deploy using plain old
ftp.

Besides, you also get the source code so you can include that in your
application if your objective is to get a single DLL.
 
S

Steven Cheng[MSFT]

Hello MC,

I agree that for your scenario, the ShareZipLib will be more appropriate
since it supports many other zip formats. The compression component in .net
framework 2.0 only support Gzip format currently, and for your scenario
since the user may create the zip attachment through other software that
product zip package other than gzip one, use the built-in one will not
work.

Also, as you mentioned that the application will be hosted on a shared
server, is your concern here that 3rd party component will need to be
install in GAC? If so, by default the sharpziplib component is
strong-named which should be put into GAC, however, since its source code
is available, you can consider compile it as a private assembly and simply
deploy it within private "bin" folder.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

mc

Ok, I'll have a look.

Thanks


mc
I very much doubt using SharpZipLib will be a problem. It will just be
a DLL you reference in your application and deploy using plain old
ftp.

Besides, you also get the source code so you can include that in your
application if your objective is to get a single DLL.
 
M

mc

Refreshingly simple to use, very useful library!

I did however have to recompile and add the Allow partially trusted
callers (APTCA) attribute to get it working on my host, who has just
tightened there security restrictions. which they say is in response to
a security hole identified by MS?

Thanks All


MC
Ok, I'll have a look.

Thanks


mc
I very much doubt using SharpZipLib will be a problem. It will just be
a DLL you reference in your application and deploy using plain old
ftp.

Besides, you also get the source code so you can include that in your
application if your objective is to get a single DLL.

I probably should have said in my initial post, the "Live" site will
be run from a shared server, so I'd like to avoid third party
components if possible!

Rad [Visual C# MVP] wrote:

SharpZipLib http://icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
could be what you are looking for at the pricely cost of 0$




I'm creating a gallery app, I would like users to be able to upload
a zip file (containing images) which I then unpack and and store in
a gallery for online review.

Do I need a third party component or can it be done in c# alone?

TIA

MC
 
S

Steven Cheng[MSFT]

Hello MC,

What is security hole you mentioned? For the APTCA attribute, if your
ASP.NET application is configured to partial trust level, making your
assembly APTCA is necessary. Also, some assembly may demand some CAS
permissions that are not grant in partial trust level policy(such as medium
or low trust level), you need to take care of this if you meet such cases.

Here are some msdn articles about using partial trust CAS in ASP.NET 2.0:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html
/paght000020.asp

http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp?frame=tr
ue


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

mc

Not being a security expert or Microsoft person I can only go on the
information released by Brinkster (My Shared Web host) They tell me that
They where informed by Microsoft of a security hole in IIS which when
the trust level was too high a tech savvy user could gain access to
other users sites, The MS solution was to apply a patch and then set the
trust levels appropriately. this, I've been told by my host is that any
external Assemblys require th APTCA and That we no-longer have access to
things like the registry or event logs (Which I've no use for).

To get my .NET 2.0 site to work all I need to do is re-publish it with
string named Assemblys and specified the APTCA attribute. after doing
this all was fine.

Once I'd recompiled the SharpZipLib assembly with APTCA it also worked fine.

MC
 
S

Steven Cheng[MSFT]

Thanks for your reply MC,

Yes, when configured as partial trust, external assemblies are required to
mark as APTCA. Also, if the appliation do need any particular CAS
permissions, we need to configure them in the security policy.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top