Advanced Search

Results 1 to 6 of 6

Thread: how to make users create fake folders to upload files on it ?

  1. #1
    Join Date
    Mar 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

  2. #2
    Join Date
    Jan 2008
    Posts
    4,158
    Thanks
    28
    Thanked 623 Times in 619 Posts
    Blog Entries
    1

    Default

    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()
    Last edited by Nile; 04-07-2010 at 12:59 PM.
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Mar 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  5. #5
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    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.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    "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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •