예제 #1
0
        // NOTE: igUpload handlers are registered in the Global.asax file
        internal static void HandlerUploadFinishing(object sender, UploadFinishingEventArgs args)
        {
            string filePath = String.Format("{0}{1}", args.FolderPath, args.TemporaryFileName);
            if (System.IO.File.Exists(filePath))
            {
                try
                {
                    string folderPath = args.FolderPath;
                    string fileName = args.FileName;
                    string mimeType = args.MimeType;
                    long fileSize = args.FileSize;

                    Dictionary<string, string> fileInfo = new Dictionary<string, string>();
                    fileInfo.Add("fileName", fileName);
                    fileInfo.Add("folderPath", folderPath);
                    fileInfo.Add("mimeType", mimeType);
                    fileInfo.Add("fileSize", fileSize.ToString());

                    Dictionary<String, Dictionary<string, string>> uploadedFiles = FileUploadController.UploadedFiles;
                    uploadedFiles.Add(args.FileName, fileInfo);
                }
                catch (Exception ex)
                {
                    args.ServerMessage = ex.Message;
                }

                args.Cancel = false;
            }
        }
예제 #2
0
        // NOTE: igUpload handlers are registered in the Global.asax file
        internal static void HandlerUploadFinishing(object sender, UploadFinishingEventArgs args)
        {
            string filePath = String.Format("{0}{1}", args.FolderPath, args.TemporaryFileName);

            if (System.IO.File.Exists(filePath))
            {
                try
                {
                    string folderPath = args.FolderPath;
                    string fileName   = args.FileName;
                    string mimeType   = args.MimeType;
                    long   fileSize   = args.FileSize;

                    Dictionary <string, string> fileInfo = new Dictionary <string, string>();
                    fileInfo.Add("fileName", fileName);
                    fileInfo.Add("folderPath", folderPath);
                    fileInfo.Add("mimeType", mimeType);
                    fileInfo.Add("fileSize", fileSize.ToString());

                    Dictionary <String, Dictionary <string, string> > uploadedFiles = FileUploadController.UploadedFiles;
                    uploadedFiles.Add(args.FileName, fileInfo);
                }
                catch (Exception ex)
                {
                    args.ServerMessage = ex.Message;
                }

                args.Cancel = false;
            }
        }
예제 #3
0
        protected static void DeleteFile(object sender, UploadFinishingEventArgs e)
        {
            string filePath = String.Format("{0}{1}", e.FolderPath, e.TemporaryFileName);
            if (File.Exists(filePath))
            {
                try
                {
                    File.Delete(filePath);
                }
                catch (Exception)
                {

                }
            }
        }
예제 #4
0
        protected static void DeleteFile(object sender, UploadFinishingEventArgs e)
        {
            string filePath = String.Format("{0}{1}", e.FolderPath, e.TemporaryFileName);

            if (File.Exists(filePath))
            {
                try
                {
                    File.Delete(filePath);
                }
                catch (Exception)
                {
                }
            }
        }
예제 #5
0
        protected void webUpload1_OnUploadFinishing(object sender, UploadFinishingEventArgs e)
        {
            string imageFolderPath     = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            // get uploaded file
            string tempFilePath = String.Format("{0}{1}", e.FolderPath, e.TemporaryFileName);

            if (this.claimID > 0 && File.Exists(tempFilePath))
            {
                try
                {
                    ClaimImage claimImage = new ClaimImage();
                    claimImage.ClaimID   = claimID;
                    claimImage.ImageName = e.FileName;
                    claimImage.IsActive  = true;
                    claimImage.UserID    = userID;

                    claimImage.IsPrint = true;

                    claimImage = ClaimImageManager.Save(claimImage);

                    imageFolderPath = string.Format("{0}/ClaimImage/{1}/{2}", appPath, this.claimID, claimImage.ClaimImageID);

                    if (!Directory.Exists(imageFolderPath))
                    {
                        Directory.CreateDirectory(imageFolderPath);
                    }

                    destinationFilePath = imageFolderPath + "/" + e.FileName;

                    System.IO.File.Copy(tempFilePath, destinationFilePath);

                    // delete temp file
                    File.Delete(tempFilePath);

                    // refresh photos
                    claimPhotos.bindData(claimID);
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
        protected void webUpload1_OnUploadFinishing(object sender, UploadFinishingEventArgs e)
        {
            string imageFolderPath = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            // get uploaded file
            string tempFilePath = String.Format("{0}{1}", e.FolderPath, e.TemporaryFileName);

            if (this.claimID > 0 && File.Exists(tempFilePath))
            {
                try
                {
                    ClaimImage claimImage = new ClaimImage();
                    claimImage.ClaimID = claimID;
                    claimImage.ImageName = e.FileName;
                    claimImage.IsActive = true;
                    claimImage.UserID = userID;

                    claimImage.IsPrint = true;

                    claimImage = ClaimImageManager.Save(claimImage);

                    imageFolderPath = string.Format("{0}/ClaimImage/{1}/{2}", appPath, this.claimID, claimImage.ClaimImageID);

                    if (!Directory.Exists(imageFolderPath))
                        Directory.CreateDirectory(imageFolderPath);

                    destinationFilePath = imageFolderPath + "/" + e.FileName;

                    System.IO.File.Copy(tempFilePath, destinationFilePath);

                    // delete temp file
                    File.Delete(tempFilePath);

                    // refresh photos
                    claimPhotos.bindData(claimID);
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }