giozua
Posts: 6
|
| Posted: 01/28/2009, 1:36 AM |
|
Hi all,
I need to create a directory on the fly
After an update, I've tried this code on After Execute Update but don't work:
$nameactivity = "flower";
$directory = "/opanel/$namectivity";
mkdir ($directory, 0755);
Someone can help me?
Thanks
Gio(vanni)
|
 |
 |
damian
Posts: 838
|
| Posted: 01/28/2009, 2:16 AM |
|
try -
$nameactivity = "flower";
$directory = "/opanel/$namectivity";
mkdir ("$directory", 0755);
also try just executing command from a link as a test - eg rule out the timing as an issue...
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
giozua
Posts: 6
|
| Posted: 01/28/2009, 3:01 AM |
|
Quote damian:
try -
$nameactivity = "flower";
$directory = "/opanel/$namectivity";
mkdir ("$directory", 0755);
also try just executing command from a link as a test - eg rule out the timing as an issue...
nothing 
|
 |
 |
damian
Posts: 838
|
| Posted: 01/28/2009, 4:29 AM |
|
what exactly does 'nothing' mean?
no error?
no directory?
wrong permissions?
what permissions do you have to root folder?
also try:
$nameactivity = "flower";
$directory = $namectivity;
echo "dir: $directory";
mkdir ("/opanel/$directory", 0755);
try also with and without the leading '/' in line 4
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
giozua
Posts: 6
|
| Posted: 01/28/2009, 5:12 AM |
|
Quote damian:
what exactly does 'nothing' mean?
no error?
no directory?
wrong permissions?
what permissions do you have to root folder?
also try:
$nameactivity = "flower";
$directory = $namectivity;
echo "dir: $directory";
mkdir ("/opanel/$directory", 0755);
try also with and without the leading '/' in line 4
I've tried all possibilities and nothing appears, no errors, only a blank page. With an echo control, I see that the name of directory is right but nothing ... I think that there is a permission problem on the server.
Thanks
Gio(vanni)
|
 |
 |
datadoit
|
| Posted: 01/28/2009, 5:50 AM |
|
Gio, look here http://us3.php.net/mkdir and implement one of the samples
given and fit it to your environment. The samples have excellent error
handling that will tell you exactly what the problem is.
|
|
|
 |
giozua
Posts: 6
|
| Posted: 01/28/2009, 6:27 AM |
|
Quote datadoit:
Gio, look here http://us3.php.net/mkdir and implement one of the samples
given and fit it to your environment. The samples have excellent error
handling that will tell you exactly what the problem is.
Thanks, but this is what I see
\an error was occurred. Attempting create folder
dirPath: /srv/www/vhosts/omnifeedback.org/httpdocs/opanel/seller\1233152815
php_errormsg:
and the error??
Gio(vanni)
|
 |
 |
datadoit
|
| Posted: 01/28/2009, 7:20 AM |
|
Let's see your new code please.
|
|
|
 |
giozua
Posts: 6
|
| Posted: 01/28/2009, 8:03 AM |
|
Quote datadoit:
Let's see your new code please.
This is the code:
function handleError() {
trigger_error('MY ERROR');
/** usage sample
@handleError();
echo $php_errormsg;
*/
}
// detect slash/backslash nomenclature dirname
$path = dirname( __FILE__ );
$slash = '/'; strpos( $path, $slash ) ? '' : $slash = '\\';
define( 'BASE_DIR', $path . $slash );
$folder = time(); // folder name
$dirPath = BASE_DIR . $folder; // folder path
// print results
echo $slash;
echo '<hr>';
$rs = @mkdir( $dirPath, '0777' );
@handleError();
if( $rs )
{
// print success information
echo 'was done!';
echo '<br>folder: <a href="' . $folder . '">' . $folder . '</a>';
echo '<br>dirPath: ' . $dirPath;
}else{
// print error information
echo 'an error was occurred. Attempting create folder';
echo '<br>dirPath: ' . $dirPath;
echo '<br>php_errormsg: ' . $php_errormsg;
}
|
 |
 |
damian
Posts: 838
|
| Posted: 01/28/2009, 10:02 AM |
|
i cut n paste your code into <?php ?> and saved it
i get success on a cpanel server
\
--------------------------------------------------------------------------------
was done!
folder: 1233165590
dirPath: /home/spm/public_html\1233165590
i suggest you check with your host to see if they are restricting you from this in some way
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
damian
Posts: 838
|
| Posted: 01/28/2009, 10:09 AM |
|
edit:
while i get the above message it isnt actually a success because it creates a folder called public_html\123165590 when it should create a folder 123165590 inside public_html/
i will try more later
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
giozua
Posts: 6
|
| Posted: 02/02/2009, 6:36 AM |
|
[SOLVED] Was a permit problem
Thanks all
Gio(vanni)
|
 |
 |