liamloveslearning Posted August 3, 2008 Share Posted August 3, 2008 Hey all, I'm just figuring out how to allow users to upload images to there own "portfolio" so be it on my website; I'm just curious however as to where to store my images; id like to store them on my host in a folder as opposed to in the mysql db itself but all I've come across online is uploading images to the mysql table, (I'm not sure if this is possible so excuse my naivety ???) Is this possible and does anyone have any ideas as to where I should start? thanks Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/ Share on other sites More sharing options...
ShaunO Posted August 3, 2008 Share Posted August 3, 2008 I don't have time to give code examples in regards to uploading files But in the MySQL vs File System storage In my opinion binary data like file contents should NOT belong in an SQL database Instead it should be on the file system If it needs to have special access permissions, they should be stored outside of the wwwroot and instead have a script load the file data and output to the browser. Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606630 Share on other sites More sharing options...
liamloveslearning Posted August 3, 2008 Author Share Posted August 3, 2008 ahh so they shouldnt be stores in say www.mysite.com/portfolioimages i should make get another root to host them in? sorry im still new to all of this Thanks Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606631 Share on other sites More sharing options...
ShaunO Posted August 3, 2008 Share Posted August 3, 2008 Only if the images aren't meant to be public Actually if you are using apache you can use a .htaccess file to disallow viewing of them It's just something you need to be mindful about as you create the script Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606634 Share on other sites More sharing options...
liamloveslearning Posted August 3, 2008 Author Share Posted August 3, 2008 no they will be public, its like a portfolio; the user wishes to upload his pictures in hope other users will see his profile and browse through his portfolio if that makes sense? Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606638 Share on other sites More sharing options...
JasonLewis Posted August 3, 2008 Share Posted August 3, 2008 You can store them anywhere, it's best to keep things organised. Have say, a folder called "uploads" then in that folder each user has their own folder where the files they upload are stored. Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606640 Share on other sites More sharing options...
ShaunO Posted August 3, 2008 Share Posted August 3, 2008 Yep, that makes sense, it wont really matter where the files are stored in that case. Don't get caught up in the hype of storing file binary data in databases, in most general cases it is not necessary. To begin, look into the move_uploaded_file() function and that should give you a lot of hints and tips to start a basic upload script. I'm sure others here can share some wisdom Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606642 Share on other sites More sharing options...
liamloveslearning Posted August 3, 2008 Author Share Posted August 3, 2008 alright, thanks everyone Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606643 Share on other sites More sharing options...
JasonLewis Posted August 3, 2008 Share Posted August 3, 2008 Some other functions you can take a look at: file_exists() getimagesize() Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606644 Share on other sites More sharing options...
liamloveslearning Posted August 3, 2008 Author Share Posted August 3, 2008 hey everyone, im still having trouble finding what i need online, I assume ill need a table called "user_portfolio" or whatever which contains the fields user_id, img_id, and then a column for the image itself; i also want to be able to send up multiple files for each user, like that on social profiles where you can upload x amount for everyone to see; does anybody have any idea where I'd find how to do this, or just confirm what im thinking with the mysql side of this is correct? thanks Link to comment https://forums.phpfreaks.com/topic/117935-image-upload/#findComment-606728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.