Example #1
0
        /// <summary>
        /// Converts an <see cref="HttpPostedFile"/> to an <see cref="UploadedFile"/>
        /// that is associated with a particular control.
        /// </summary>
        /// <param name="controlUniqueID">
        /// The UniqueID of the control with which the returned <see cref="UploadedFile"/>
        /// should be associated.  If the <see cref="UploadedFile"/> is added to an
        /// <see cref="UploadedFileCollection"/>, the UniqueID can be used to retrieve
        /// it.
        /// </param>
        /// <param name="file">
        /// The <see cref="HttpPostedFile"/> to convert to an <see cref="UploadedFile"/>.
        /// </param>
        /// <returns>
        /// The <see cref="UploadedFile"/> that corresponds to the <see cref="HttpPostedFile"/>.
        /// </returns>
        /// <remarks>If an <see cref="IUploadModule"/> is not installed or it does not support
        /// conversion, this method will delegate to <see cref="UploadStorage.ConvertToUploadedFile"/>
        /// which will use the currently configured <see cref="UploadStorageProvider"/>
        /// </remarks>
        public static UploadedFile ConvertToUploadedFile(string controlUniqueID, HttpPostedFile file)
        {
            UploadedFile uploadedFile = null;

            if (InstalledModule != null)
            {
                uploadedFile = InstalledModule.ConvertToUploadedFile(controlUniqueID, file);
            }
            if (uploadedFile == null)
            {
                uploadedFile = UploadStorage.ConvertToUploadedFile(controlUniqueID, file);
            }
            return(uploadedFile);
        }
Example #2
0
 UploadedFile IUploadModule.ConvertToUploadedFile(string controlUniqueID, HttpPostedFile file)
 {
     return(UploadStorage.ConvertToUploadedFile(controlUniqueID, file));
 }