These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

File Upload standalone

Is there any way of loading the File Upload from outside the FileVista Control?  I need to send an email message each time a file is uploaded and would like to call the file upload feature of the FileVista Control.
Jon 3/17/2008 1:45 PM
As of current version, you can not call the upload window outside the control but you can subscribe to the Uploaded event to send email notifications on uploads, see the code below:

if (FileVistaControl.Uploaded == null) 
FileVistaControl.Uploaded += new EventHandler<FileVistaUploaded EventArgs>(FileVistaControl_Uploaded); 


static void FileVistaControl_Uploaded(object sender, FileVistaUploadedEventArgs e)
        {
            string emailMessage;

            int transferRate = (e.UploadProgress.TimeElapsed.TotalSeconds > 0) ? (int)(e.UploadProgress.UploadedSize / e.UploadProgress.TimeElapsed.TotalSeconds) : 0;

            emailMessage = "Path: " + GleamTech.IO.FolderInformation.CombinePath(e.RootFolder.Name, e.RelativePath) + "\n";
            emailMessage += "Upload Size: " + GleamTech.IO.FileInformation.FormatSize(e.UploadProgress.UploadedSize) + "\n";
            emailMessage += "Upload Time: " + String.Format("{0:00}:{1:00}:{2:00}", e.UploadProgress.TimeElapsed.Hours, e.UploadProgress.TimeElapsed.Minutes, e.UploadProgress.TimeElapsed.Seconds) + "\n";
            emailMessage += "Transfer Rate: " + GleamTech.IO.FileInformation.FormatSize(transferRate) + "/Sec" + "\n";
            emailMessage += "Uploaded Files: ";
            foreach (GleamTech.Web.FileTransfer.UploadedFile uploadedFile in e.UploadProgress.UploadedFiles)
                emailMessage += "\t" + uploadedFile.Name + "\n";

            //Get the current uploading user from your membership system or from a session variable
            //string whoUploaded = HttpContext.Current.Session["UserName"]);
            //emailMessage = whoUploaded + " uploaded some files, here is the information:\n" + emailMessage;

            //SendEmail(emailMessage);
        }
Cem Alacayir 3/24/2008 7:20 AM