View Full Version : how to make users create fake folders to upload files on it ?
Hello
i have a simple file upload script with users system
i want to make users in control panel able to create - delete - rename folders
and can upload files on it
how can i do this ?
and is this will be hard ??
thanks and sorry for bad english
It shouldn't be to hard - just not very secure. Here are the functions you should be using:
glob()
is_file()
rename()
unlink() be very careful!
fopen()
fclose()
djr33
04-07-2010, 05:43 PM
It can be secure enough if you are careful:
1. Only allow certain types of files: for example, .htm, .jpg, and .txt. Never allow any sort of file that could have dangerous code in it, like .php and .asp.
(Make a list of "OK" filetypes and make sure it is one of those, and do NOT make a list of "not OK" filetypes, because you might forget one and someone could hack your server.)
2. Make sure that '../' is NOT part of the file/folder name. This means that they cannot gain access to higher levels in your site.
It may not be completely secure, but it should be close if done correctly.
thanks guys
but you get me wrong
i talk about fake folders exactly like categories not the real folders that save it in ftp
so now i want to make categories in user control pane so the user can create a category and upload files on it
please tell me how i do this ?
thanks very much
Schmoopy
04-07-2010, 06:56 PM
You could just have a big folder filled with random files if that's what you mean, and then add each file to a database when a user uploads one, then depending on the user, show the files applicable to them.
djr33
04-08-2010, 03:15 AM
"fake folders" do not exist, so I do not know how you want to "make" one.
If you want to create a storage location and list of "folders" for each user, then you just need to do both: create a place to store and create a database of "folders" ("locations"), and connect that to images.
For example, in your database:
REAL LOCATION: | FAKE LOCATION: | NAME:
~users/1/321.jpg | myimages/test.jpg | test
There is no "official" way to do this. Use a database to remember where the pictures are on the server, and to remember the fake location for the user's information.
I don't know why you want to do this, but it is possible if you use a setup like I explained above.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.