Exemplo n.º 1
0
        void btnUpload_Click(object sender, EventArgs e)
        {
            Page.Validate("upload");

            if ((Page.IsValid) && (uploader.HasFile))
            {
                //temporarily store the .zip in the /Data/Sites/[SiteID]/systemfiles folder
                string destFolder = SiteUtils.GetSiteSystemFolder();

                DirectoryInfo di = new DirectoryInfo(destFolder);
                if (!di.Exists)
                {
                    di.Create();
                }

                string destPath = Path.Combine(destFolder,
                                               Path.GetFileName(uploader.FileName).ToCleanFileName(WebConfigSettings.ForceLowerCaseForUploadedFiles));

                if (File.Exists(destPath))
                {
                    File.Delete(destPath);
                }

                uploader.SaveAs(destPath);


                // process the .zip, extract files
                SkinHelper helper = new SkinHelper();
                helper.InstallSkins(SiteUtils.GetSiteSkinFolderPath(), destPath, chkOverwrite.Checked);

                // delete the temporary file
                File.Delete(destPath);
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
        }