using System; using System.Data; using System.Configuration; using System.Collections; using System.Drawing.Imaging; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Drawing; using System.Collections.Generic; using Bytescout.BarCodeReader; namespace WebTestSharp { public partial class _Default : System.Web.UI.Page { protected void UploadButton_Click(object sender, EventArgs e) { String savePath = @"\uploads\"; if (FileUpload1.HasFile) { String fileName = FileUpload1.FileName; savePath += fileName; FileUpload1.SaveAs(Server.MapPath(savePath)); Reader barcodeReader = new Reader(); // reader.MediumTrustLevelCompatible = true; // uncomment this line to enable Medium Trust compatible mode (slows down the recognition process as direct image data access is disabled in Medium Trust mode) UploadStatusLabel.Visible = false; ListBox1.Items.Clear(); ListBox1.Visible = true; ListBox1.Items.Add("Reading barcode(s) from image #" + imgNum); FoundBarcode[] barcodes = barcodeReader.ReadFrom(savePath); if (barcodes.Length == 0) { ListBox1.Items.Add(" No barcodes found"); } else { foreach (FoundBarcode barcode in barcodes) ListBox1.Items.Add(String.Format("Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value)); } } else { // Notify the user that a file was not uploaded. UploadStatusLabel.Text = "You did not specify a file to upload."; } } } }
using Bytescout.BarCodeReader;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)