NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadPage.aspx.cs" Inherits="YourNamespace.UploadPage" %>

<!DOCTYPE html>
<html>
<head>
<title>File Upload Example</title>
</head>
<body>
<form runat="server">
<div>
<asp:FileUpload ID="fileUpload" runat="server" />
<asp:CustomValidator ID="fileValidator" runat="server" ControlToValidate="fileUpload"
ClientValidationFunction="validateFileExtension" OnServerValidate="fileValidator_ServerValidate"
ErrorMessage="Only JPEG, PNG, and SVG files are allowed." />
<asp:Button ID="submitButton" runat="server" Text="Upload" OnClick="submitButton_Click" />
</div>
</form>

<script type="text/javascript">
function validateFileExtension(sender, args) {
var fileName = args.Value;
var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
if (ext === "jpg" || ext === "jpeg" || ext === "png" || ext === "svg") {
args.IsValid = true;
} else {
args.IsValid = false;
}
}
</script>
</body>
</html>




using System;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.CV.Cuda;
using Emgu.CV.UI;

namespace YourNamespace
{
public partial class UploadPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void fileValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
string fileName = fileUpload.FileName;
string ext = fileName.Substring(fileName.LastIndexOf('.') + 1).ToLower();

args.IsValid = (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "svg");
}

protected void submitButton_Click(object sender, EventArgs e)
{
if (IsValid)
{
// Load the uploaded image
var image = new Image<Bgr, byte>(fileUpload.FileContent);

// Load the Haar Cascade for face detection
var faceCascade = new CascadeClassifier(Server.MapPath("~/App_Data/haarcascade_frontalface_default.xml"));

// Detect faces in the image
var faces = faceCascade.DetectMultiScale(image, 1.1, 10, Size.Empty);

if (faces.Length > 0)
{
// At least one face was detected
// Process the result or display a message
}
else
{
// No faces were detected
// Process the result or display a message
}
}
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.