Parsi Coders

نسخه‌ی کامل: سورس کد فشرده سازی فایل ,قرار دادن پسوورد و اپلود فایل (asp.net)
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
با سورس زیر میتونید یک فایل رو اپلود کنید و تبدیل به زیپ کنید و حتی روش پسوورد بزارید !



عکسی از سورس:

[عکس: 43505-221821-5ZipWeb1.jpg]



قسمتی از سورس :

کد:
using Ionic.Zip;

using System.IO;



public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {



    }

    protected void btnZip_Click(object sender, EventArgs e)

    {        

        // SINGLE FILE UPLOAD AND ZIP EXAMPLE START //



        try

        {

            if (FileUpload1.HasFile)

            {        

                // Mention path where your zip file save

                var path = "E:\\" + FileUpload1.FileName + ".zip";



                // Zip File and save in your mentioned path

                using (var zip = new ZipFile())

                {

                    zip.AddEntry(FileUpload1.FileName, FileUpload1.FileContent);

                    zip.Save(path);

                }



                lblmsg.Text = "Single file zipped successfully here :   " + path + "



";

            }

            else

            {

                lblmsg.Text = "Select file to be archieve!";

            }

        }

        catch(Exception ex)

        {

            lblmsg.Text="Error During Zip operation " + ex.ToString();

        }



        // SINGLE FILE UPLOAD AND ZIP EXAMPLE END //

                

        // FOLDER ZIP EXAMPLE START //



        //Metion your File Path here

        string folderpath = "E:\\test";



         try            

         {

             string fname;

                using (var zip = new ZipFile())

                {

                    //Here i set password property to the zip file

                    zip.Password = "test123";

                    zip.AddDirectory(folderpath);

                    fname = folderpath + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".rar";

                    zip.Save(fname);

                    lblmsg.Text += "Multiple files are zipped here:   " + folderpath + "


";

                }

                // extract entries that use encryption

                using (ZipFile zip = ZipFile.Read(fname))

                {

                    zip.Password = "test123";

                    zip.ExtractAll("extractDir");

                }



              

         }

        catch(Exception ex)

        {

            lblmsg.Text="Error During Multiple file zip operation!";

        }

        // MULITPLE FILE UPLOAD AND ZIP EXAMPLE END //

    }

}



سورس کد با سی شارپ asp.net نوشته شده

پیوستش میکنم :



دانلود :
[attachment=179]