Re: [PHP] cannot make directory at remote host



ross@xxxxxxxxxxxxx wrote:
Hi,

I can make the files now after setting the permission to my images folder but I cannot delete the folder or images in it. I have tried unlink and rmdir with no success. Even with filezilla cannot delete it


The problem seems to be the images that are set to chmod of 600 and cannot be changed. I upload the file with this

move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $img_url)

is there a way to set the permissions of the images on upload to anything other than 600?

R.




From: "Chris" <dmagick@xxxxxxxxx>
To: "blueboy" <ross@xxxxxxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Thursday, June 07, 2007 12:08 AM
Subject: Re: [PHP] cannot make directory at remote host


blueboy wrote:
This work localy but not on my remote host. How can I debug it?

if(!(is_dir('images/$customer_id')))
{
mkdir("images/$customer_id", 0700);

}

The file is in the main public_html folder and there is a images folder.

First tip - always use full paths instead of local ones so you know *exactly* where it's going.

If it goes under the current folder (and I hope you have some basic checking here somewhere for customer_id):

$customer_id = (int)$customer_id;
if ($customer_id <= 0) {
die("Bad customerid!");
}

$dir = dirname(__FILE__) . '/images/' . $customer_id;

if (!is_dir($dir)) {
mkdir($dir, 0700);
}

What should the permissions be?

Depends on the host (whether they are running php in cgi mode or as an apache module).

Check if safe-mode is on or off.

Check the parent folder to make sure that the webserver user has write & execute access to be able to get into the base folder.

display errors and turn error reporting up to work out why it's not working.

--
Postgresql & php tutorials
http://www.designmagick.com/


look into umask()

http://us2.php.net/umask

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare
.



Relevant Pages

  • Re: Problem viewing uploaded images using ASP.NET
    ... "I can post images with FTP and the uploadform" - ... one might describe a car problem to a mechanic ... you are experiencing some sort of permission issue. ... that folder," but again, I can't assume that until I know specifically what ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Login control and restricted member pages
    ... As you said the login dialog prompts each time the page loading a image, ... protected folder. ... When a page display some images file, ... NTFS permission limitation. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: viewing in Firefox requesting Authentication, trying to rerout
    ... - open html folder and replace the previous index.htm file (yes, ... don't understand is how Publisher is writing that code. ... Are you inserting a code fragment to import your images or just inserting ... Be sure to compress your graphics before you upload again. ...
    (microsoft.public.publisher.webdesign)
  • Re: Pages not uploading
    ... Do the images now load on your home page? ... Publisher, and write the links yet once again. ... folder on your C drive where you directed your HTML output when you Publish ... index.htm file and the index_files folder from your webspace, and upload the ...
    (microsoft.public.publisher.webdesign)
  • RE: Images are disapearing
    ... What version of Publisher is being used? ... Version 2003 will create an "index_files" folder if using the subfolder ... These images you speak of, ... Picture Manager was introduced in version 2003 of Office so I guess I can ...
    (microsoft.public.publisher.webdesign)