How should upload Multiple Images as BMP or JPG

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
greatbillo
Posts: 2
Joined: Thu Jan 11, 2018 12:29 pm

How should upload Multiple Images as BMP or JPG

Post by greatbillo »

I am in middle of developing a system and using Evaluation version. What i want to know that how can I upload all images scanned at once at as a image . i can save Multipage PDF and Mutlipage TiFF and also i can upload scanned files one by one but i want to upload all images at once

Code: Select all


string fn = new Random().Next(0, 100)+"-test.jpg";
            string fileName = Server.MapPath("~/Images/" + fn);
            Request.Files[0].SaveAs(fileName);

           fn = new Random().Next(0, 100) + "-test.jpg";
            fileName = Server.MapPath("~/Images/" + fn);
            Request.Files[1].SaveAs(fileName);
            
Request.Files[0] has no error but Request.Files[1] get an error ... it seems WCF Service send only 1 file to upload
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: How should upload Multiple Images as BMP or JPG

Post by Alex »

Hello,

Please see our Web TWAIN Demo with Local Web Service:
https://demos.vintasoft.com/AspNetMvcTw ... calService

Demo shows how to acquire images from scanner and upload single or all images to HTTP(S) server.

Source codes of demo can be found in distributive package of VintaSoft Twain .NET SDK: "[InstallPath]\VintaSoft Twain .NET v10.2\Examples\CSharp\AspNetMvc5TwainDemos\".

Best regards, Alexander
greatbillo
Posts: 2
Joined: Thu Jan 11, 2018 12:29 pm

Re: How should upload Multiple Images as BMP or JPG

Post by greatbillo »

"Upload all acquired images as multipage TIFF or PDF file "
this option is only enabled when TIFF or PDF selected and disabled for BMP and JPG. if i make it active for BMP and JPG its only upload single file

when i see the code of ImageUpload.aspx

Code: Select all

 protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Files.Count == 0)
            {
                return;
            }

            // save the file to the server
            string fileName = Server.MapPath("Images/demo.jpg");
            Request.Files[0].SaveAs(fileName);

            // return the path to this file
            Response.Clear();
            Response.Write("http://" + Request.Url.Authority + Request.RawUrl.Substring(0, Request.RawUrl.LastIndexOf("/")) + "/Images/demo.jpg");
            Response.Flush();
        }
    }
its only hendle Request.Files[0] and if i try to make it Request.Files[1] it gives an error
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: How should upload Multiple Images as BMP or JPG

Post by Alex »

Hello,

Have you see the "UploadScannedImages" function in "[InstallPath]\VintaSoft Twain .NET v10.2\Examples\CSharp\AspNetMvc5TwainDemos\Views\TwainDemoWithLocalService\Index.cshtml" file? Functions shows how to upload one or several image files to HTTP server. Please see the function code and let me know if you will have any question or problem.

Best regards, Alexander
Post Reply