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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:26:41+00:00 2026-06-15T12:26:41+00:00

I want to automatically create a folder, using the users email address, if one

  • 0

I want to automatically create a folder, using the users email address, if one does not already exists. This action should occur when they upload a file.

SOLVED. I updated this code for anyone who might need it. Thanks!

Here is my code:

if(isset($_POST["checkFile"]) && $_FILES["selectFile"]["name"] != "") {
            $target_path_pdf = "uploads/pdfs/$email/";

            if ( ! is_dir($target_path_pdf)) {
                mkdir($target_path_pdf);
            }

            $target_path_pdf = $target_path_pdf . str_replace(' ', '_', basename($_FILES["selectFile"]["name"]));
            if(move_uploaded_file($_FILES["selectFile"]["tmp_name"], $target_path_pdf)) {
            }
            else {
                $flag = 1;
            }
            $pdfcaption = $_POST['pdfCaption1'];
        }

        if(isset($_POST["checkPicture"]) && $_FILES["selectPicture"]["name"] != "") {
            $target_path_pic = "uploads/pictures/$email/";

            if ( ! is_dir($target_path_pic)) {
                mkdir($target_path_pic);
            }


            $target_path_pic = $target_path_pic . str_replace(' ', '_', basename($_FILES["selectPicture"]["name"]));
            if(move_uploaded_file($_FILES["selectPicture"]["tmp_name"], $target_path_pic)) {
            }
            else {
                $flag = 1;
            }
            $piccaption = $_POST['picCaption1'];
        }
  • 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-06-15T12:26:42+00:00Added an answer on June 15, 2026 at 12:26 pm

    This might not be super secure, but that’s a different problem.

    For the first part:

    $target_path_pdf = "uploads/pdfs/$email/";
    
    if(!is_dir($target_path_pdf)){
        mkdir($target_path_pdf);
    }
    

    http://php.net/manual/en/function.mkdir.php

    EDIT

    Even though it might be obvious it can’t hurt to explain.
    The script simply checks if the directory already exists, and if it doesn’t it creates one.

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

Sidebar

Related Questions

I want to sign users in automatically after they create an account. My application
I want create module which update list of usb devices automatically (not only mass
I want to be able to automatically create playlists in an specific playlist folder
This is killing me! I'm using django-filebrowser, and I want to create a gallery
When I use Maven archetype quickstart , it does not create src/main/resources folder and
I want to create a folder under the Start Menu using InnoSetup. On Windows
I want to create a custom set that will automatically convert objects into a
I want my code to automatically try multiple ways to create a database connection.
I want to use T4 templates to automatically create some code but I want
I want to create a new project in C# using VS2010 and I wonder

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.