ImageUploaderController gives error during image uploading to editor

Muhammad Kaleem asked on March 2, 2019 08:11

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);

Recent Answers


Roman Hutnyk answered on March 2, 2019 11:15

What is the error you're receiving?

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on March 2, 2019 12:12

when i create "HttpPostedFileWrapper file"object in if condition it says "file does not exist in the current context"

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 5, 2019 10:22

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.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.