示例#1
0
        /// <summary>
        /// Handles the Click event of the lbSaveFiles control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void lbSaveFiles_Click(object sender, EventArgs e)
        {
            FileStreamInfo[] fsi = FileUpCtrl.Files;
            if (fsi != null && fsi.Length > 0)
            {
                try
                {
                    StringBuilder filePath = new StringBuilder(Server.MapPath(ManagementHelper.GetImportExportFolderPath(_MetaDataImportFolder)));
                    filePath.Append(fsi[0].FileName);

                    if (File.Exists(filePath.ToString()))
                    {
                        File.Delete(filePath.ToString());
                    }

                    FileUpCtrl.SaveAs(fsi[0], filePath.ToString());
                    FileUpCtrl.ReleaseAll();

                    // update upload status
                    lblUploadResult.Text = String.Empty;                     //"File saved successfully.";
                    UploadResultPanel.Update();
                }
                catch (Exception ex)
                {
                    lblUploadResult.Text = ex.Message;
                    UploadResultPanel.Update();
                }
                finally
                {
                    FilesControl.DataBind();
                    FilesPanel.Update();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Handles the Click event of the lbSaveFiles control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void lbSaveFiles_Click(object sender, EventArgs e)
        {
            FileStreamInfo[] fsi = FileUpCtrl.Files;
            if (fsi != null && fsi.Length > 0)
            {
                try
                {
                    string filePath = Path.Combine(HttpContext.Current.Server.MapPath(ManagementHelper.GetImportExportFolderPath("catalog")), fsi[0].FileName);

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

                    FileUpCtrl.SaveAs(fsi[0], filePath);
                    FileUpCtrl.ReleaseAll();

                    // update upload status
                    lblUploadResult.Text = String.Empty;                     //"File saved successfully.";
                    UploadResultPanel.Update();
                }
                catch (Exception ex)
                {
                    lblUploadResult.Text = ex.Message;
                    UploadResultPanel.Update();
                }
                finally
                {
                    FilesControl.DataBind();
                    FilesPanel.Update();
                }
            }
        }