Пример #1
0
        private void fileManager_FileUploading(object source, FileManagerFileUploadEventArgs e)
        {
            //上传时,将文件copy到/Images目录去,并生成不尺寸的几张图
            var os   = _collectionSource.ObjectSpace;
            var temp = os.FindObject <IICons>(new BinaryOperator("FullName", e.File.FullName));

            if (temp == null)
            {
                temp      = os.CreateObject <IICons>();
                temp.Name = e.File.Name.Substring(0, e.File.Name.Length - e.File.Extension.Length);
                var dirName = e.File.Folder.FullName.Split('\\');
                if (dirName.Length > 1)
                {
                    dirName[1] = "Images";
                }

                temp.ImageName = e.File.Extension + "@" + string.Join("+", dirName) + "+" + temp.Name;
                temp.FullName  = e.File.FullName;

                _collectionSource.Add(temp);
                os.CommitChanges();
            }
            SaveFile(e.InputStream, e.File.FullName, 12, e.File.Extension);
            SaveFile(e.InputStream, e.File.FullName, 16, e.File.Extension);
            SaveFile(e.InputStream, e.File.FullName, 32, e.File.Extension);
            SaveFile(e.InputStream, e.File.FullName, 48, e.File.Extension);
            //保存记录到数据库,供选择,不保存也可以
            //_collectionSource.Add(
        }
Пример #2
0
 protected void UnitFileManager_FileUploading(object source, FileManagerFileUploadEventArgs e)
 {
     if (folder != null)
     {
         string     version  = System.Environment.Version.ToString();
         string     file     = e.FileName;
         string     fullpath = folder + "\\" + file;
         FileStream fs       = new FileStream(fullpath, FileMode.CreateNew, FileAccess.ReadWrite);
         e.InputStream.CopyTo(fs);
         fs.Close();              //close the new file created by the FileStream
         e.Cancel    = true;      //cancelling the upload, prevents duplicate uploads
         e.ErrorText = "Success"; //shown when the upload is cancelled
         UnitFileManager.Settings.RootFolder = folder;
     }
 }
Пример #3
0
 protected void FileManager_FileUploading(object sender, FileManagerFileUploadEventArgs e)
 {
     HtmlEditor.RaiseImageSelectorFileUploading(e);
 }
Пример #4
0
        //protected void btnSubmit_Click(object sender, EventArgs e)
        //{
        //    //MailHelper pHelper = GetMailHelper ();
        //    //pHelper.SendMail (txtTo.Text, txtSubject.Text, txtBody.Text);

        //}

        protected void fmAttachments_FileUploading(object source, FileManagerFileUploadEventArgs e)
        {
            //On upload - we want to overwrite
            MpOptions.AllowOverwrite = true;
        }
Пример #5
0
 protected void DemoHtmlEditor_DocumentSelectorFileUploading(object source, FileManagerFileUploadEventArgs e)
 {
     ValidateSiteEdit(e);
 }
Пример #6
0
 protected void ASPxFileManager1_FileUploading(object source, FileManagerFileUploadEventArgs e)
 {
     ProviderOptions.AllowOverwrite = Convert.ToBoolean(HiddenField["overwrite"]);
 }
Пример #7
0
 protected void fileManager_FileUploading(object sender, FileManagerFileUploadEventArgs e)
 {
     ValidateSiteEdit(e);
 }
Пример #8
0
 protected void he_ImageSelectorFileUploading(object source, FileManagerFileUploadEventArgs e)
 {
     e.FileName = String.Format("image{0}", Path.GetExtension(e.FileName));
 }
Пример #9
0
	/// <summary>
	/// Uploading a file - log the action
	/// </summary>
	/// <param name="source">source of event</param>
	/// <param name="e">contains the new file information</param>
	void FileManager_FileUploading(object source, FileManagerFileUploadEventArgs e)
	{
		// if the file already exists, delete it so we can upload the new file
		if (File.Exists( e.File.FullName ))
		{
			// make sure that we are configured to allow replacing files
			if (WebConvert.ToBoolean(webSettings.Lookup("AllowReplace", "0"), false))
			{
				// make sure that we are allowed to delete files
				if (fz.AllowFileDelete(Master.UserName, rootFolder))
				{
					File.Delete(e.File.FullName);
				}
			}
		}
		// log the upload request
		log.LogActivity(LogAction.Upload, Master.UserName, e.File.FullName, e.ErrorText);
	}