Results 1 to 6 of 6

 

Thread: folder permissions

  1. #1
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts


    so I have this script that allows user to upload a picture, but to do this the folder the pictures are being copied into needs to be writeable.

    what if some smart ass decides to save over some pictures? uploaded a huge file to my server and download it a few times? or worse, uploads some script which does bad things?

    is there a way where i can make the folder writeable, but only by myscript.php or make it so that myscript.php automatically logs in or identifies itself somehow so that only it can upload?

    cheers
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  2. #2
    aka Antony

    Status
    Offline
    Join Date
    Mar 2005
    Location
    Bristol
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont really know the answer but heres what Id be looking at if doing this

    1. Definitely have the user upload area as a separate area from your own images folder, hence you only issue is users overwriting each others images

    2. look into how you can have the script itself enable writing to the folder at the start, then allow the changes and then disable. I think the command is chmod 777 to allow all, not sure what the number is to set it back.

    3. ive heard that any sort of system where you allow users to upload files can be really dangerous so make sure you only allow image files not .exe, and also read up on the security aspects (I seem to remember reading once about nasty files disguised as jpgs)

  3. #3
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    1 and 3 already taken care of, on with 2 now. ftp_chmod seems to be what I was looking for

    ta
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    661
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can set a maximum upload size for the files if you are worried about bandwidth. I found this tutorial handy.
    http://www.notepad.co.uk/articles/php_tutorial_019.php

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Jul 2004
    Location
    Sheffield
    Posts
    388
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You should be ok if you limit to gif/jpg extensions - I think (and may be wrong here!) that the server only sends pictures to the browser rather than opens them (similar to forwarding an email with attachments without opening the attachment) so essentially your server should be ok - however the visitor may be at risk.

    As for overwriting one users files by another user, if they're signing up, allocate each user with their own unique id (which I presume you'll do anyway) and just prefix the filename with that when you upload it. At least then you will know who's caused you problems if they do occur later on and get the basball bat out

    HTH

    Chris

  6. #6
    Super Member

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Costa Del Sheffield
    Posts
    2,838
    Thanks
    5
    Thanked 18 Times in 14 Posts
    thank ya'll, sorted now, I think. didnt get the folder permissions to change by themselves though, damn php safe mode...

    upload file sizes capped, upload file types limited and a few other bits and bobs to keep them all in order
    Dan Morley
    alpharooms.com
    daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
    My Blog | Cheap Holidays



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2