public virtual UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { if (storageConfig != null && storageConfig.Count != 0) { throw new ApplicationException(this.Name + " doesn't understand InputFile.StorageConfig."); } return this.CreateUploadedFile(context, controlUniqueID, fileName, contentType); }
public virtual UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { if (storageConfig != null && storageConfig.Count != 0) { throw new ApplicationException(this.Name + " doesn't understand InputFile.StorageConfig."); } return(this.CreateUploadedFile(context, controlUniqueID, fileName, contentType)); }
public static UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { UploadedFile file = null; if (storageConfig == null || storageConfig.Count == 0) { file = Provider.CreateUploadedFile(context, controlUniqueID, fileName, contentType); } else { file = Provider.CreateUploadedFile(context, controlUniqueID, fileName, contentType, storageConfig); } return(file); }
public static UploadedFile ConvertToUploadedFile(string controlUniqueID, HttpPostedFile file) { // We use a temporary UploadContext so that we have something we can pass to the // UploadStorageProvider. Note that unlike when the UploadHttpModule is used, // this temporary context is not shared between uploaded files. UploadContext ctx = new UploadContext(); ctx._ContentLength = HttpContext.Current.Request.ContentLength; UploadStorageConfig storageConfig = UploadStorage.CreateUploadStorageConfig(); string storageConfigString = HttpContext.Current.Request.Form[Constants.ConfigNamePrefix + "-" + controlUniqueID]; if (storageConfigString != null && storageConfigString != string.Empty) { storageConfig.Unprotect(storageConfigString); } UploadedFile uploadedFile = UploadStorage.CreateUploadedFile(ctx, controlUniqueID, file.FileName, file.ContentType, storageConfig); System.IO.Stream outStream = null, inStream = null; try { outStream = uploadedFile.CreateStream(); inStream = file.InputStream; byte[] buf = new byte[4096]; int bytesRead = -1; while (outStream.CanWrite && inStream.CanRead && (bytesRead = inStream.Read(buf, 0, buf.Length)) > 0) { outStream.Write(buf, 0, bytesRead); } } finally { if (inStream != null) { inStream.Close(); } if (outStream != null) { outStream.Close(); } } return(uploadedFile); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { return(new FilesystemUploadedFile(this, controlUniqueID, fileName, contentType, storageConfig)); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return(this.CreateUploadedFile(context, controlUniqueID, fileName, contentType, null)); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return(new HashingFilesystemUploadedFile(this, controlUniqueID, fileName, contentType)); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { return new FilesystemUploadedFile(this, controlUniqueID, fileName, contentType, storageConfig); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return this.CreateUploadedFile(context, controlUniqueID, fileName, contentType, null); }
public static UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return(CreateUploadedFile(context, controlUniqueID, fileName, contentType, null)); }
public static UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType, UploadStorageConfig storageConfig) { UploadedFile file = null; if (storageConfig == null || storageConfig.Count == 0) { file = Provider.CreateUploadedFile(context, controlUniqueID, fileName, contentType); } else { file = Provider.CreateUploadedFile(context, controlUniqueID, fileName, contentType, storageConfig); } return file; }
public static UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return CreateUploadedFile(context, controlUniqueID, fileName, contentType, null); }
public override UploadedFile CreateUploadedFile(UploadContext context, string controlUniqueID, string fileName, string contentType) { return new HashingFilesystemUploadedFile(this, controlUniqueID, fileName, contentType); }
UploadedFile IUploadModule.ConvertToUploadedFile(string controlUniqueID, HttpPostedFile file) { // We use a temporary UploadContext so that we have something we can pass to the // UploadStorageProvider. Note that unlike when the UploadHttpModule is used, // this temporary context is not shared between uploaded files. UploadContext ctx = new UploadContext(); ctx._ContentLength = HttpContext.Current.Request.ContentLength; UploadStorageConfig storageConfig = UploadStorage.CreateUploadStorageConfig(); string storageConfigString = HttpContext.Current.Request.Form[Constants.ConfigNamePrefix + "-" + controlUniqueID]; if (storageConfigString != null && storageConfigString != string.Empty) { storageConfig.Unprotect(storageConfigString); } UploadedFile uploadedFile = UploadStorage.CreateUploadedFile(ctx, controlUniqueID, file.FileName, file.ContentType, storageConfig); System.IO.Stream outStream = null, inStream = null; try { outStream = uploadedFile.CreateStream(); inStream = file.InputStream; byte[] buf = new byte[4096]; int bytesRead = -1; while (outStream.CanWrite && inStream.CanRead && (bytesRead = inStream.Read(buf, 0, buf.Length)) > 0) { outStream.Write(buf, 0, bytesRead); } } finally { if (inStream != null) inStream.Close(); if (outStream != null) outStream.Close(); } return uploadedFile; }