i have copy this controller from dancing goat sample project, it gives error when i create object of "HttpPostedFileWrapper file" in if condition, any help will be highly appreciated
if (!(Request.Files[requestFileName] is HttpPostedFileWrapper file))
{
return Guid.Empty;
}
var directoryPath = EnsureUploadDirectory();
var imagePath = GetTempFilePath(directoryPath, file);
byte[] data = new byte[file.ContentLength];
file.InputStream.Seek(0, System.IO.SeekOrigin.Begin);
file.InputStream.Read(data, 0, file.ContentLength);
What is the error you're receiving?
when i create "HttpPostedFileWrapper file"object in if condition it says "file does not exist in the current context"
Does the part Request.Files[requestFileName] return the actual file? As it can't seem to find that file. Which, when trying to match type and set as a variable in HttpPostedFileWrapper file, will not work.
Request.Files[requestFileName]
HttpPostedFileWrapper file
Please, sign in to be able to submit a new answer.