Reputation: 15197
I'm trying to get an image but i get the error Parameter not valid with the following code.
if (File.Exists(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
{
using (Bitmap image = new Bitmap(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
{
//other code
}
}
The inner exception is null.
The Path after this is mapped is:
\C:\Users\Shaun\Documents\FormValue\ExtractedFiles\Box1e84b34a-522b-492e-919f-1334ee5845ff\ca4ac72a-9ca2-4a28-b4a4-a6031b734567.png
Upvotes: 0
Views: 3273
Reputation: 441
I got this exception when file was too large.
to solve it, change 'FileSizeLimitInBytes' in registry editor
If it still doesn't help, you change 'FsCtlRequestTimeoutInSec' too:
don't forget to restart your windows computer
for more details https://support.microsoft.com/en-us/help/2668751/you-cannot-download-more-than-50-mb-or-upload-large-files-when-the-upl
Upvotes: 0
Reputation: 94584
Getting an Invalid Parameter Exception for a new Bitmap(String)
, where the file exists generally means that the file content is invalid and can't be parsed by any of the image type handlers.
One of the most common reasons for this is that the underlying file is of 0
size.
Upvotes: 2