Jump to content

mkdir seems to create invisible directories....


Dragen

Recommended Posts

Hi,

I've got my script which checks if a directory exists, if not creates it. It seems to be working fine. I create the directory and upload a file to it and can then view the file on the server through my browser.

 

Now the problem starts when I look at it with any ftp client. For some reason I can't see the created directories or files. In my directory I should have something such as:

root/images/products/clothing/tops/myfile.gif

But I can only view up to products (which looks empty). Products is a directory created at the same time as the invisible directories/files, so it's confusing me... anyway, here's my code:

<?php
  if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $catdir)) {
    if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $catdir)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
  } else {
  	mkdir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $catdir, 0700);
  }
?>

 

am I using the mkdir wrong? I haven't used it before, but I don't see a problem with it.

 

Thanks

Link to comment
Share on other sites

Its pretty hard to tell whats going on with all the constants, but it looks ok. Have you tried creating a test dir? eg;

 

<?php

  mkdir("root/images/products/test",0700);

?>

 

Just to see if you can see it.

Link to comment
Share on other sites

try this

 

<?php
  if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $catdir)) {
    if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $catdir)) $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
  } else {
  	mkdir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . "$catdir", 0700);
  }
?>

Link to comment
Share on other sites

thanks for the suggestions..

I'm not quite sure what putting the variable between quotes would do.

I testing creating a different directory and it works fine, it's just when I use the code above. My host say that the ownership settings may have been set up incorrectly. I have no idea what that means or how to change them, but they seemed to suggest that I couldn't, which makes me wonder how they could be set up incorrectly if I can't do anything to them :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.