Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6117565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:20:07+00:00 2026-05-23T15:20:07+00:00

I am using PHP to create a directory. After the directory is created it

  • 0

I am using PHP to create a directory. After the directory is created it is given a chmod of 777. I then have a simple script for a user to upload a file to the directory. The issue that I am having is that the directory will not complete the file transfer when I run the script. BUT… if I manually go in via FTP and create a new directory and assign 777 to the generated folder then the script works fine and the file is transferred. Is there some set-up with my web host that is limiting this ability? Or is it in the PHP script? Here is the code wherein I create the new directory:

<?php

$thisdir = getcwd(); 
$new_dir = 'test';
$full_dir = $thisdir . "/" . $new_dir;

function chk_dir($full_dir) {
if(is_dir($full_dir)) {
    echo 'the directory already exists';
} else {
    return mkdir($full_dir);
}

}
chk_dir($full_dir);
chmod($full_dir, 0777);
?>

I know there must be a simple explanation for this, thank you for reviewing my issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:20:07+00:00Added an answer on May 23, 2026 at 3:20 pm

    Check if Safe_mode is turn on on your server.

    mkdir() creates folder as owner, it’s not the script owner, so the scripts couldn’t upload the file into that folder. While safe_mode is turned on chmod() dosen’t work.
    Doc: http://php.net/manual/en/features.safe-mode.php

    try adding this line at the beginning of the php script to check for warnings:

    ini_set('display_errors', '1');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the PHP function mkdir($path, 0777) to create a new directory on
Using strictly SQL (no PHP or anything else), is it possible to create a
Using PHP and MySQL, I have a forum system I'm trying to build. What
In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess
I have been using PHP and JavaScript for building my dad's website. He wants
I have an app using PHP and the PayPal API. The basic way it
I am able to generate a link using my file upload system, now after
I have created a website using ASP.NET MVC and use ELMAH for error handling,
I want to create an application in PHP implementing virtual directory feature. Example: http://mydomain.com/user001
Using PHP, what's the fastest way to convert a string like this: 123 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.