private void OnFileUploaded(UploadFileEventArgs e)
 {
     if (FileUploaded != null)
     {
         FileUploaded(this, e);
     }
 }
Example #2
0
 void controller_FileUploaded(object sender, UploadFileEventArgs e)
 {
     if (FileUploaded != null)
     {
         FileUploaded(this, e);
     }
 }
        internal bool ProcessFileUpload(FileManagerItemInfo destDir, System.Web.HttpPostedFile uploadedFile, out string script)
        {
            UploadFileCancelEventArgs cancelArg = new UploadFileCancelEventArgs();
            cancelArg.DestinationDirectory = destDir;
            cancelArg.PostedFile = uploadedFile;
            OnFileUploading(cancelArg);

            if (cancelArg.Cancel)
            {
                script = ClientMessageEventReference(cancelArg.ClientMessage);
                return false;
            }

            string saveName = cancelArg.SaveName;
            string fileNameWithoutExtension = saveName.Substring(0, saveName.LastIndexOf('.'));
            string extension = saveName.Substring(saveName.LastIndexOf('.'));

            string ext = extension.ToLower(CultureInfo.InvariantCulture).TrimStart('.');
            if (HiddenFilesArray.Contains(ext) ||
                    ProhibitedFilesArray.Contains(ext))
            {
                script = ClientMessageEventReference(null);
                return false;
            }

            string newFileName = GetNotDuplicatedFileName(destDir, fileNameWithoutExtension, extension);
            FileManagerItemInfo itemInfo = ResolveFileManagerItemInfo(VirtualPathUtility.AppendTrailingSlash(destDir.FileManagerPath) + newFileName);

            uploadedFile.SaveAs(itemInfo.PhysicalPath);

            UploadFileEventArgs arg = new UploadFileEventArgs();
            arg.UploadedFile = itemInfo;
            OnFileUploaded(arg);

            script = ClientRefreshEventReference;
            return true;
        }
 private void OnFileUploaded(UploadFileEventArgs e)
 {
     if (FileUploaded != null)
         FileUploaded (this, e);
 }
 void controller_FileUploaded(object sender, UploadFileEventArgs e)
 {
     if (FileUploaded != null)
         FileUploaded(this, e);
 }