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

  • SEARCH
  • Home
  • 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 6742771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:52:58+00:00 2026-05-26T11:52:58+00:00

Am using uploadify to allow users on my site upload profile pictures which stored

  • 0

Am using uploadify to allow users on my site upload profile pictures which stored in folders corresponding to their username.
For example, a user with username “mrx” has folder “/beta/profiles/mrx/avatars/”.
It works well on my local system, but when i uploaded only the “mrx” parent folder is created with the permission “0000”;
I pass the upload folder for the users via a hidden input which has the path to their folder as its value.
Am using codeigniter and webroot looks like this

public_html/
beta/
application/
system/
assets/
profiles/
/mrx/
m/

The mrx folder is supposed to have the “avatars” inside it,but is not created by my uploadify script;

This is the uploadifiy script

if (!empty($_FILES)) {
   $file = new Uploader();
   $path = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
   if(!file_exists($path))
   {
      mkdir($path,0777,true);
   }
   $file_temp = $_FILES['Filedata']['tmp_name'];
   $file_name = $file->prep_filename($_FILES['Filedata']['name']);
   $file_name = ereg_replace(" ","_",$file_name);

   $file_ext = $file->get_extension($_FILES['Filedata']['name']);
   $real_name = $file_name;
   $newf_name = $file->set_filename($path, $file_name, $file_ext,TRUE);
   $file_size = round($_FILES['Filedata']['size']/1024, 2);
   $file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES['Filedata']['type']);
   $file_type = strtolower($file_type);
   $targetFile =  str_replace('//','/',$path) . $newf_name;
   move_uploaded_file($file_temp,$targetFile);

   $filearray = array();
   $filearray['file_name'] = $newf_name;
   $filearray['real_name'] = $real_name;
   $filearray['file_ext'] = $file_ext;
   $filearray['file_size'] = $file_size;
   $filearray['file_path'] = $targetFile;
   $filearray['file_temp'] = $file_temp;
   //$filearray['client_id'] = $client_id;

   $json_array = json_encode($filearray);
   echo $json_array;
}else{
    echo "1";   
}

And this the controller that passes the folder to uploadify

function avatar()
        {

            $this->isloggedin();
            $data['title'] = "Your Avatar | PheedBakk";
            $data['username'] = $this->session->userdata("username");
            $data['user_id'] = $this->session->userdata('user_id');
            $data['avatar'] = $this->site_config->get_setting_value('default_avatar');
            $data['user'] = $this->user_model->profile($data['username']);
            $data['upload_folder'] = "/beta/profiles/".$this->session->userdata('username')."/avatars";



            $this->load->view('templates/user_header',$data);
            $this->load->view('templates/user-left-bar');
            $this->load->view('settings/avatar');
            $this->load->view('templates/user-right-bar');
            $this->load->view('templates/footer');
        }

What am doing wrong?

  • 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-26T11:52:59+00:00Added an answer on May 26, 2026 at 11:52 am

    Create one folder and then the other without recursive set to true…

    $path1 = "/beta/profiles/$username";
    $path2 =  "/beta/profiles/$username/avatars";
    
        mkdir($path1,0777);
        mkdir($path2,0777);
    

    Or call chmod on the directory once the folder is created:

    chmod("/beta/profiles/$username/avatars", 0777);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Uploadify to upload files. Problem is, I need to inform users
I am using a script to upload photo (written by my own) which allow
So I am using the Uplodify plugin to allow users to upload multiple images
I am using uploadify to allow images upload in a form. The issue i'm
I'm using a small site to experiment with the uploading of pictures and displaying
I'd like to add some functionality to a site that would allow users to
There is a part of my website that allows users to upload profile photos.
I'm using Uploadify to allow for multi file uploading in my web application. It
I am using uploadify along with ASP.NET to upload files to my server. At
I am planning on using, either the Uploadify or Plupload, image upload libraries in

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.