DEVILofDARKNESS Posted August 17, 2009 Share Posted August 17, 2009 for school I had to make a site about poems, all works fine, but only one problem they want to be able to add images, music, video's etc. Now I've to do everything manual. Now I want to let the users upload it themself. I'm thinking of making a new table user_id(tinyint) poem_id(tinyint) type(enum) should I make an upload system, or should I say they have to store it somewhere else, like imageshack.us and give the link? I can trust the users, beause only people I know and are in my class can 'join' the site. Quote Link to comment https://forums.phpfreaks.com/topic/170610-solved-need-a-way-to-let-users-upload-music-images/ Share on other sites More sharing options...
ignace Posted August 17, 2009 Share Posted August 17, 2009 Most likely you want to create a directory for each and every user to store their media, however when doing so you will not only allow them but also every visitor that stumbles upon it can sniff those directories. You can use .htaccess, but do you possess the skill to write the required complex code? and is it worth the effort? Personally I would create the upload system using PHP as it allows the fine grained control I want and it keeps it simple. P.S. type(enum) Just some advice, don't use an enum but use a varchar instead. Create constants that holds certain values and can be used throughout your application: define('MEDIA_TYPE_IMAGE', 'image'); define('MEDIA_TYPE_VIDEO', 'video'); define('MEDIA_TYPE_MUSIC', 'music'); INSERT INTO table VALUES ($users_id, $poems_id, MEDIA_TYPE_*) switch ($type) { case MEDIA_TYPE_IMAGE: //logic break; case MEDIA_TYPE_VIDEO: //logic break; case MEDIA_TYPE_MUSIC: //logic break; } This way you can avoid typo's (and decrease bugs) as an undefined constant throws a notice but is converted to a string ("MEDIA_TYPE_MUSIC") while a typo is valid nonetheless Quote Link to comment https://forums.phpfreaks.com/topic/170610-solved-need-a-way-to-let-users-upload-music-images/#findComment-899905 Share on other sites More sharing options...
DEVILofDARKNESS Posted August 17, 2009 Author Share Posted August 17, 2009 so I have a table: user_id poem_id MEDIA_TYPES_* name ---1----------1----------image---------example.jpg ---2----------1----------video----------test.avi ? for the upload system I will just take one from the internet is this good enough? Quote Link to comment https://forums.phpfreaks.com/topic/170610-solved-need-a-way-to-let-users-upload-music-images/#findComment-899994 Share on other sites More sharing options...
ignace Posted August 17, 2009 Share Posted August 17, 2009 for the upload system I will just take one from the internet is this good enough? If it fits your needs. Quote Link to comment https://forums.phpfreaks.com/topic/170610-solved-need-a-way-to-let-users-upload-music-images/#findComment-900384 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.