Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,585 members, 7,809,116 topics. Date: Thursday, 25 April 2024 at 11:51 PM

How Do I Handle Uploaded Photos On A Webserver?? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Do I Handle Uploaded Photos On A Webserver?? (926 Views)

Programmers Need Better Debugging Ideas. Here's How To Handle Bugs. / Arduino Webserver: Internet Based Gas Leakage Detector Using A talkinMobile App / Need An International Community Of Developers Certified To Handle Ur Website/app (2) (3) (4)

(1) (Reply)

How Do I Handle Uploaded Photos On A Webserver?? by teampregar(m): 3:29pm On Jun 25, 2016
I want to allow users to upload photos on my project but i am confused if i should store the name of the location(path) and name of the uploaded photo on a database then when it is requested i fetch the photo from the location a include it or if i should just give uploaded photos a similar name like index.jpg or photo.jpg then when it is requested i just include the profile path + photo.jpg, for example ,
<?php $username = //any user name?>
<img src="examplewebsite.com/<?php echo $username ?>/photo.jpg " >..
Please those who have handled projects that allows user to upload and access photos should help me with a solution..
Re: How Do I Handle Uploaded Photos On A Webserver?? by maekhel(m): 3:57pm On Jun 25, 2016
The way I would do this is:
When saving the uploaded photo, concatenate a random string(eg timestamp) to the photo name to avoid overwriting a previously uploaded photo with the same name and then move photo to a preferred directory (eg uploads) on the file system and finally if the move successful save the photo name into the database.

I would have said you should save the path+photo name into the database but situation might arise when you may want to change the directory you upload photos along the way. And this will mean you will have to start replacing in your database too.

Hope it makes sense.

1 Like

Re: How Do I Handle Uploaded Photos On A Webserver?? by teampregar(m): 7:50pm On Jun 25, 2016
maekhel:
The way I would do this is:
When saving the uploaded photo, concatenate a random string(eg timestamp) to the photo name to avoid overwriting a previously uploaded photo with the same name and then move photo to a preferred directory (eg uploads) on the file system and finally if the move successful save the photo name into the database.

I would have said you should save the path+photo name into the database but situation might arise when you may want to change the directory you upload photos along the way. And this will mean you will have to start replacing in your database too.

Hope it makes sense.
Thanks Alot..

(1) (Reply)

4 Benefits Of Partnering With Splashz.com / Acute Email Ids Production Engine / Latest Trends In Software Development

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.