Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add images on my website.I am having an folder for the stored images. If i add any new images into the folder the image should also diplay on my website if i delet image from my folder image also get deleted from my website.is there any way in html or anything to do this.I don't want to change the code of webpage all time.

What I have tried:

I trying it for my free image webpage.
Posted
Updated 31-Mar-21 23:31pm
Comments
OriginalGriff 4-Mar-21 3:35am    
What have you tried?
What were the results?
What help do you need?
Member 15084650 4-Mar-21 4:27am    
i tried to rename the images of my folder it works but if i want to do it for n number of images its not poosible.i want to that is there any concept that can automatically delet image from my website if i delet it and if add a new image in my folder it should automatically inserted in my website
OriginalGriff 4-Mar-21 5:00am    
The simplest way is not to use a folder: use a database instead.
Store the image under an "neutral" filename in a single folder: a GUID is fine.
Then store the GUID in the DB, along with the "real name" of the image and so forth.
Then serve the images from that DB. That way, you don't have to change any file names - just DB column data - and when you delete an image you drop it from the DB as well.
Member 15084650 4-Mar-21 6:57am    
i also tried the to store in database but images i stored in the folder should also shown in website.i just need solution for adding n number of images on my website.if i add any image in my folder it should also display on my webpage

It sounds like you have a folder with images within, and you want to be able to automatically display all those images on the web-page without having to manually amend the HTML.

This doesn't seem possible from Javascript because it's client-side, so you'd need have the page built using a language like PHP, Java or ASP.NET where those languages can perform operations like listing directory contents, and then render the page dynamically based on the files it's found. The PHP scandir()[^] function is a good example of this.

There might also be some JS server-side frameworks which might work too, though I'm not aware of them I'm afraid!
 
Share this answer
 
by using datalist in c# asp.net we can do that we only need to add images in the specific folder.they are many videos regarding it on youtube.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900