In recieiving html input from a user(rich text editor) , I would like to limit the amount of images they have submitted. Is there a way to allow the first few images and then remove the rest?
The images are in the form
<img src="">
In recieiving html input from a user(rich text editor) , I would like to limit the amount of images they have submitted. Is there a way to allow the first few images and then remove the rest?
The images are in the form
<img src="">
If you are looking to do this server side, use the HTMLAgilityPack. You can give it the HTML content and query this, in your case you'd want a list of all html images. Using this list, you could verify the count, remove elements etc. Example(using links, not images in this sample of code):
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
TextReader TR= new StringReader(SomeText);
doc.Load(TR);
HtmlNodeCollection collection = doc.DocumentNode.SelectNodes("//a[@href]");