//private ImageUploaderDialog _imageUploaderDialog = new ImageUploaderDialog() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploaderDialog",DialogTitle = "上传图片"};
		//private ImageUploader _imageUploader = new ImageUploader() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploader" };

        protected internal override void OnPagePreRender(Page page)
		{
			if (page.Form != null)
			{
                var div = this.GetControlsContainerInPage(page);

				ImageUploaderDialog imageUploaderDialog = new ImageUploaderDialog() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploaderDialog", DialogTitle = "上传图片" };
				ImageUploader imageUploader = new ImageUploader() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploader" };

				div.Controls.Add(imageUploaderDialog);
				div.Controls.Add(imageUploader);
			}
		}
Exemplo n.º 2
0
		public static void UploadFile(ImageUploader uploadControl, HttpPostedFile file, string originalName, string newName, out string filePath)
		{
            filePath = string.Empty;

			string path = GetUploadRootPath("ImageUploadRootPath");
            string tempPath = Path.Combine(path + @"Temp\", newName);
			AutoCreateUploadPath(path);

			var beforeArgs = new UploadEventArgs(originalName);
			uploadControl.OnBeforeUploadFile(beforeArgs);
			file.SaveAs(Path.Combine(path + @"Temp\", newName));
			var afterArgs = new UploadEventArgs(newName);
			uploadControl.OnAfterUploadFile(afterArgs);

            filePath = tempPath;
		}
        //private ImageUploaderDialog _imageUploaderDialog = new ImageUploaderDialog() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploaderDialog",DialogTitle = "上传图片"};
        //private ImageUploader _imageUploader = new ImageUploader() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploader" };

        //protected internal override void OnPagePreInit(Page page)
        //{
        //    if (page.Form != null)
        //    {
        //        var div = this.GetControlsContainerInPage(page);

        //        ImageUploaderDialog imageUploaderDialog = new ImageUploaderDialog() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploaderDialog", DialogTitle = "上传图片" };
        //        ImageUploader imageUploader = new ImageUploader() { ID = "ImageUploaderPropertyEditorForGrid_ImageUploader" };

        //        div.Controls.Add(imageUploaderDialog);
        //        div.Controls.Add(imageUploader);
        //    }
        //}

        protected internal override void OnPagePreRender(Page page)
        {
            if (page.Form != null)
            {
                var div = this.GetControlsContainerInPage(page);

                ImageUploaderDialog imageUploaderDialog = new ImageUploaderDialog()
                {
                    ID = "ImageUploaderPropertyEditorForGrid_ImageUploaderDialog", DialogTitle = "上传图片"
                };
                ImageUploader imageUploader = new ImageUploader()
                {
                    ID = "ImageUploaderPropertyEditorForGrid_ImageUploader"
                };

                div.Controls.Add(imageUploaderDialog);
                div.Controls.Add(imageUploader);
            }
        }
Exemplo n.º 4
0
        public static void UploadFile(ImageUploader uploadControl, HttpPostedFile file, string originalName, string newName, out string filePath)
        {
            filePath = string.Empty;

            string path     = GetUploadRootPath("ImageUploadRootPath");
            string tempPath = Path.Combine(path + @"Temp\", newName);

            AutoCreateUploadPath(path);

            var beforeArgs = new UploadEventArgs(originalName);

            uploadControl.OnBeforeUploadFile(beforeArgs);
            file.SaveAs(Path.Combine(path + @"Temp\", newName));
            var afterArgs = new UploadEventArgs(newName);

            uploadControl.OnAfterUploadFile(afterArgs);

            filePath = tempPath;
        }