Click here to Skip to main content
12,893,481 members (55,904 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
There is a List view for images in my .aspx page, I want to delete selected image from the folder without using database as my site is static and i have not used database, how can i delete selected image from the folder? please help.
Posted 26-Mar-13 21:12pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Do something like this :-

  string FileName ="test.txt";
  string Path = "E:\\" + FileName;
  FileInfo file = new FileInfo(Path);
  if (file.Exists)

Get your file name from listview and then find the path then delete.
And do remember to include using System.IO; namespace.
So simple Isn't it?



here you can get your image name from list view.

Happy Holi.
Member 12809622 22-Dec-16 5:38am
Hi there, I am using the same code of yours but fileinfo's variable file is null ? why is the file not coming /what is the error ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

datatable dt=selecet postid from postdetails

var a= dt.rows.count;

var i;
datatable dt1=select imagepath from image where postid=dt[i][0]
var b=dt1.rows.count;
var temp=dt1[j][0];

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 17 Apr 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100