Hi,In solution explore sub folder contain image files (OR) files .How to get filename and how to access through my coding part.
Give replay as early as possible.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 30, 2009, 8:54 PM EDT
Suppose you have image in images folder and image name is test.jpg
then
you can access it like below code
string path = Server.MapPath("images").ToString() + @"\test.jpg";
Response.Write(path);
Image1.ImageUrl = path;
if my answer helps you "Check Do you like this answer" please :)
lokesh muppana30 reputationPosted Oct 30, 2009, 9:15 PM EDT
By using FTP ,so many people are uploading images in a imagefloder.i do not know what imagenames are using and uploading in my imagefloder.i know only imagefloder.How to get the imagefile names and stored in string arrray data type.
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 30, 2009, 9:18 PM EDT
you can get FileNames in List With Below Code
using System.IO;
string path = Server.MapPath("images").ToString();
string[] FileNames = Directory.GetFiles(path);
lokesh muppana30 reputationPosted Oct 30, 2009, 9:42 PM EDT
Thanks.
lokesh muppana30 reputationPosted Oct 30, 2009, 11:01 PM EDT
--------------------------------------------------------------------
string path = Server.MapPath("MyFiles").ToString();
string[] FileNames = Directory.GetFiles(path);
Image1.ImageUrl =FileNames[0];
Image2.ImageUrl =FileNames[1];
Image3.ImageUrl =FileNames[2];
Image4.ImageUrl =FileNames[3];
foreach (string s in FileNames)
{
Response.Write(s);
Response.Write("
");
}
-----------------------------------------------------------------------
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 30, 2009, 11:09 PM EDT
Friend,
check "Do you like this answer" please :)
you should Write like below
Image1.ImageUrl =Server.MapPath("MyFiles").ToString() +@"\"+FileNames[0];lokesh muppana30 reputationPosted Oct 30, 2009, 11:44 PM EDT
protocaol:not available
address:not avaliable
size: not avaliable
string path = Server.MapPath("MyFiles").ToString();
string[] FileNames = Directory.GetFiles(path);
Image1.ImageUrl = Server.MapPath("MyFiles").ToString() + @"\" + FileNames[0];
Image2.ImageUrl = Server.MapPath("MyFiles").ToString() + @"\" + FileNames[1];
Image3.ImageUrl = Server.MapPath("Myfiles").ToString() + @"\" + FileNames[2];
Image4.ImageUrl = Server.MapPath("MyFiles").ToString() + @"\" + FileNames[3];
foreach (string s in FileNames)
{
Response.Write(s);
Response.Write("
");
}
-----------------------------------------------------------------------------------------------------------------------------------------------------
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 30, 2009, 11:52 PM EDT