I restricted my fileexplorer to only accept images using SearchPattern property.
Is it possible that we can also control the dimension of the image file that gets uploaded? e.g. only allow people to upload image files with dimension of 500x600.
thanks in advance
1 Answer, 1 is accepted
0
Vessy
Telerik team
answered on 04 Dec 2012, 12:07 AM
Hi,
Currently the desired functionality is not available out of the box but you could achieve it by subclassing the existing FileSystemContentProvider and overriding the StoreFile() method. In order to take the dimensions of the uploaded images, you could create an instance of the EditableImage class from the uploaded file's memory stream and access them in a similar way:
public partial class FileExplorer : System.Web.UI.Page
var editableImage = new EditableImage(file.InputStream);
var height = editableImage.Height;
var width = editableImage.Width;
if (height > maxHeight || width > maxWidth)
{
return string.Empty;
}
//existing file will be overwritten!
file.SaveAs(physicalPath);
return targetPath;
}
Regards,
Vesi
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.