Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    21
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Permissions Problem

    Hi peeps,

    I need help. This is part of a code that uploads images to my webserver however it wont assign permissions. I need the files that upload (pics) to have 775,, can anybody help?

    [php]copy ($line[tmp_name], '../temp/' . $file);
    $new = new_dim ($info[0], $info[1], $sizes[small][0], $sizes[small][1]);
    resize ('../temp/' . $file, 'cp-thumbs/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
    $new = new_dim ($info[0], $info[1], $sizes[thumb][0], $sizes[thumb][1]);
    resize ('../temp/' . $file, '../thumbs/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
    $new = new_dim ($info[0], $info[1], $sizes[large][0], $sizes[large][1]);
    resize ('../temp/' . $file, '../images/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
    $new = new_dim ($info[0], $info[1], $sizes[enlarge][0], $sizes[enlarge][1]);
    resize ('../temp/' . $file, '../enlarge/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
    unlink ('../temp/' . $file);
    mysql_query ('INSERT INTO ' . $dbimgs . ' VALUES(\'0\', \'' . $_POST['id'] . '\', \'' . $file . '\')', $link);
    mysql_query ('UPDATE ' . $dblist . ' SET images=images+1 WHERE id=\'' . $_POST['id'] . '\' LIMIT 1', $link);
    $upload = true;
    continue;[php]

  • #2
    New Coder
    Join Date
    Jan 2012
    Posts
    53
    Thanks
    8
    Thanked 4 Times in 4 Posts
    If you make the images upload into a folder with permissions 775 then they should all have 775 as their default permission.

  • #3
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • #4
    New Coder
    Join Date
    Jan 2012
    Posts
    21
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DarkLaika View Post
    If you make the images upload into a folder with permissions 775 then they should all have 775 as their default permission.
    You would think but it dosent, It sets them to 600 Is it an Apache thing?

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    21
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    Hello Sir,

    Not real good with PHP but should I insert a tag like this somewhere?

    [php] chmod("/mydir", 755);[p]

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by bnorris View Post
    You would think but it dosent, It sets them to 600 Is it an Apache thing?
    No its down to the filesystem settings of the host OS.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by bnorris View Post
    Hello Sir,

    Not real good with PHP but should I insert a tag like this somewhere?

    [php] chmod("/mydir", 755);[p]
    Yeah like that, but for all the files in the dir. You could do that using one of the recursive iterator SPL objects, or just track the files your uploading and chmod them through there (definitely the best option).
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • #8
    New Coder
    Join Date
    Jan 2012
    Posts
    21
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    Yeah like that, but for all the files in the dir. You could do that using one of the recursive iterator SPL objects, or just track the files your uploading and chmod them through there (definitely the best option).
    This script is a photo uploader and it dose many a day. Funny thing is it works on other (unix) servers ok but not this Linux box Would it hel if I posted the whole page? pastebin??

  • #9
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by tangoforce View Post
    No its down to the filesystem settings of the host OS.
    This.
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • Users who have thanked BluePanther for this post:

    tangoforce (01-24-2012)

  • #10
    New Coder
    Join Date
    Jan 2012
    Posts
    21
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    This.

    Would you happen to know what setting in Apachie?

  • #11
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by bnorris View Post
    Would you happen to know what setting in Apachie?
    Again, it's down to the filesystem of the host OS

    Not Apache, not the FTP server, the OPERATING SYSTEM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

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