How to get and save image to folder from listview

Dominik Kolouch

I need to get selected items from a ListView and copy them to a folder.

I select folder with images and then show them in the ListView. Now I need to get all the selected items and copy them into another selected folder. Is there a way how to do it with better control then listview ?

I tried a few methods, but nothing works.

Sevo

One approach:

int counter = 1;
        foreach (ListViewItem item in listView1.SelectedItems)
        {
            var image = item.ImageList.Images[item.ImageKey]; //or imageIndex
            using (MemoryStream memory = new MemoryStream())
            {
                using (FileStream fs = new FileStream($@"C:\temp\outputFileName_{counter}", FileMode.Create, FileAccess.ReadWrite))
                {
                    image?.Save(memory, ImageFormat.Jpeg);
                    byte[] bytes = memory.ToArray();
                    fs.Write(bytes, 0, bytes.Length);
                }
            }
            counter++;
        }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to correctly get image from 'Resources' folder in NetBeans

How to save an image to Camera folder in android?

How to save image to user folder in django?

How to get image file from public folder as a response in Laravel?

How to save an image to a specific folder with Cloudinary?

How to save image into resource folder java swing

How to get index of image from ListView on onmouseover event?

How to save image to camera folder in Android Q?

How to get a image from gallery, crop it and save it in app

How to change code get image from a folder in github

Image Manipulation - How do I save original, resize & save in folder A and make thumbnail & save in folder B

how to upload image in database save in folder?

Catel: MVVM how to get selected value from a listview and save it to a variable?

How to auto save highcharts as image in specific folder

How to Save Image to Application Folder from UIImagePickerController?

Save image from url to special folder

How to get image id from listVIew

How to save image canvas to folder?

How to get image from assets by folder ios

How to get image from url and save it in mysql as BLOB ? php

How to save image from URL in server folder using php or javascript?

How to save an image in a folder?

How to save or move image files from application to general media folder

How to save image from url into assets folder

How do i get a random image from a folder python

How to read all image from folder and save image with same name in other folder python

how to get the application folder from the docker image

How to save create a folder and save an image in Flutter?

How to get images from folder to show in listview builder?