which is best method to upload and store an image? in a webserver or in a mysql database? actually i am coding a script that could allow users to upload their profile picture. how to do it in a safe way without any security risk and maximising the performance?
On my site at www.unitedlocalbands.com I allow user to save the url link of their picture from photobucket to my database. Then I use my server script (in my case its coldfusion) and an sql statment to return that link to an image tag. This way I dont have to allow them to upload any files to my server. Photobucket has a great tool the you can add to your site so that the user doesnt have to even leave your site to log into photobucket. You just have to add an iframe to your site. i.e. <img src="<cfoutput>#user.pictureurl#</cfoutput>"/> Code (markup): the img tag above looks like this to the web browser after coldfusion inserts the url, <img src="http://www.picture.jpg"/> Code (markup): Are you using a server side script?
The old db -v- file system question.... generally it is more effecient to stick it on the webserver rather than the SQL server if you are hosting the files yourself rather than unitedlocalbands suggestion of only pointing to the image rather than uploading it.