bluespiked Posted August 7, 2013 Share Posted August 7, 2013 Hi!I have stumbled on a feature in which I am unable to get around my head. I was wondering if anyone knew a script which allows a user to upload a file to a specific directory through html?So there could be 5 upload boxes for images, and then at the bottom of the html there could be a submission form which selects what directory the file is uploaded to?I'm trying to not sound confusing but an example is I could upload "moonmoon.jpg1","moonmoon2.jpg", "moonmoon3.jpg" to "mysite.com/goddamnit/images" without evening leaving the page "mysite.com/upload".I would be really grateful if anyone has a php script and html piece which could allow me to get over this problem.-bluespiked Quote Link to comment https://forums.phpfreaks.com/topic/280928-how-to-allow-users-to-chose-the-upload-directory/ Share on other sites More sharing options...
requinix Posted August 7, 2013 Share Posted August 7, 2013 Who invited Moon Moon!? Don't give users the ability to upload to any directory they wish. If you have real, actual directories then make a list of ones you do want users to be able to upload into and provide that in a dropdown or something. (Then make sure to validate that what they choose really is in that list.) If you do want any arbitrary directory then you need something smarter... Quote Link to comment https://forums.phpfreaks.com/topic/280928-how-to-allow-users-to-chose-the-upload-directory/#findComment-1443881 Share on other sites More sharing options...
bluespiked Posted August 7, 2013 Author Share Posted August 7, 2013 Hi! I think I see where your coming from. It was meant to be a closed system for just one person to access. I just have a PHP script which generates a new directory (for an image album) with a custom name (because the directory name appears as the album name). I was hoping to find a way to upload images to this newly generated directory. Quote Link to comment https://forums.phpfreaks.com/topic/280928-how-to-allow-users-to-chose-the-upload-directory/#findComment-1443884 Share on other sites More sharing options...
requinix Posted August 7, 2013 Share Posted August 7, 2013 Well... alright. Assuming all the directories to choose from are at the same level (same parent directory) then glob + GLOB_ONLYDIR will get you an array of names you can stick into a . If you get a full path and just want the directory name, basename. Quote Link to comment https://forums.phpfreaks.com/topic/280928-how-to-allow-users-to-chose-the-upload-directory/#findComment-1443890 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.