Jump to content

need help with mkdir permissions


blue-genie

Recommended Posts

I'm doing a flash app where i save webcam images to a folder on the server.

I'm able to make this work when running of xampp on my machine, I create the required folder structure and I'm able to read from that folder and display the images, however once i move the stuff onto a live server, it fails to create the folders and it seems to be a permission problem. Is it server specific?

 

i've tried chmod etc but I don't think i'm doing it right. any help, pointers for a non php developer would be most helpful.

 

here's my code snippet

 

<?php

//This project is done by vamapaull: http://blog.vamapaull.com/

//The php code is done with some help from Mihai Bojin: http://www.mihaibojin.com/

 

$uid = $_GET[uid];

$structure = './images/' .  date("Ymd") .'/' . $uid. '/';

 

// To create the nested structure, the $recursive parameter

// to mkdir() must be specified.

 

 

if(is_dir($structure))

{

echo "Exists!";

}

else

{

echo "Doesn't exist" ;

 

if (!mkdir($structure,'0777', true) ) {

    die('Failed to create folders...');

}

}

 

 

if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){

$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

$img = $_GET["img"];

$filename = 'images/' . date("Ymd"). "/" .$uid. "/img_". mktime(). ".jpg";

file_put_contents($filename, $jpg);

} else{

echo "Encoded JPEG information not received.";

}

?>

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.