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 6037869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:08:12+00:00 2026-05-23T06:08:12+00:00

I am trying to create a directory that is inside of a folder called

  • 0

I am trying to create a directory that is inside of a folder called upload. Here is my current simple code that I tried to get this done:

<?php

$thisdir = getcwd(); 
$new_dir = '145';


if(mkdir("/upload/" . $newdir, 0777))
{
echo "Directory has been created successfully...";
}
else
{
echo "Failed to create directory...";
} 
?>

There must be some simple fix that I am missing. Can you place it? Thanks.

  • 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-23T06:08:13+00:00Added an answer on May 23, 2026 at 6:08 am

    Your php daemon will not have permission, by default, to write inside a folder called /upload (/ being the root directory). You would need to make this folder write accessible for this command to work.

    However, saying this, surely this problem is resulting from an error with your code and you aren’t working within your current directory. I am guessing your code should read…

    if(mkdir($thisdir . "/upload/" . $newdir, 0777))
    

    In which case it should work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a simple shell script for recursively creating directories inside a
I'm trying to create a wrapper/handler that will be called on the Apache server
I am trying to write a simple VBS script that will create folders on
I am trying to create a directory in Java. I think I have provided
I am trying to create a virtual directory and set it's permissions using IIS7
I am trying to create a file in the /tmp directory (working on a
i am trying to traverse a given directory and create a list of files
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Ok so I am trying create a login script, here I am using PHP5
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation

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.