Jump to content

How to allow users to chose the upload directory.


bluespiked

Recommended Posts

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 icon_smile.gif

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...

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. 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.