wartotojas Posted November 24, 2009 Share Posted November 24, 2009 Hi everybody, Im realy new guy with php, at the moment trying to build a webpage that would allow people to register, login and upload images (create albums that everybody could see). I managed to create registration and login forms, my sessions are finally working and I started with file uploads and adding them to albums. Im not really sure if its possible to do so, but what Im looking for is that lets say user wants to create an album, hits an upload button and a new folder within server is created with the same name as album, is it possible? to handle file uploads I was following this tutorial: http://articles.sitepoint.com/article/php-gallery-system-minutes/1 Basicaly it would do what Iam looking, but at the very end it doesn't... It connects to my database, uploading form works, confirmation message appears when files are uploaded, records in one of the tables are created, files are renamed but they dont appear anywhere in my server... Is there something missing with this tutorial, and the files that are included? or its just me? Any hints or any other tutorials that would do same thing would be appreciated? Thanks for help Quote Link to comment https://forums.phpfreaks.com/topic/182817-some-help-with-image-uploads/ Share on other sites More sharing options...
Stuie_b Posted November 26, 2009 Share Posted November 26, 2009 by deafult move_uploaded_files() will fail to work if the destination directoy doesnt exist, you need to ensure it exists before moving the upload.. the following should surfice <?php if(!is_dir("DESTINATION DIR HERE")){ mkdir("DESTINATION DIR HERE"); } ?> Stuie Quote Link to comment https://forums.phpfreaks.com/topic/182817-some-help-with-image-uploads/#findComment-965766 Share on other sites More sharing options...
oni-kun Posted November 26, 2009 Share Posted November 26, 2009 You need to set permissions, but here is concept code.. <?php function createAlbum() { if(!is_dir("/albums/".$row['username']."/".$row['albumname'])){ mkdir("/albums/".$row['username']."/".$row['albumname']"); //After cleaning and checking for any security risks. } //Upload data now using forms.. } It was something similar to what I did before.. Quote Link to comment https://forums.phpfreaks.com/topic/182817-some-help-with-image-uploads/#findComment-965774 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.