Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
After hours of searching here and Google, I decided to ask for help.
I want the code posted to create a subdirectory in directory uploads, named by the variable $userDir. It does not give any errors in php error logs but it also does not create the sub-directory.
Code:
<?php
$userDir = $_POST['user_dir'];
$targetFolder = '/uploads';
if (!file_exists($targetFolder.'/'.$userDir)) {
mkdir($targetFolder.'/'.$userDir, 0700, true);
}
//* Some other code here
?>
Does anyone know why it does not create the folder?
Then the folder may already exist - but not where you think it is.
Try replacing your mkdir line to:
if (!file_exists(getcwd().$targetFolder.'/'.$userDir)) {
mkdir(getcwd().$targetFolder.'/'.$userDir, 0700, true);
}
Correct your target path :
$targetPath = $_SERVER['DOCUMENT_ROOT'].$targetFolder.'/'.$userDir;
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 days ago.
Improve this question
In Laravel's routes directory i created G01 folder and inside this folder i have another folder such as H220.
this is my route:
Route::get('/glob', function () {
$model_name = 'G01';
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('./'.$model_name.'/H220'),
RecursiveIteratorIterator::SELF_FIRST
);
});
finally when i refresh the page with this address:127.0.0.1/glob i get this error:
UnexpectedValueException
RecursiveDirectoryIterator::__construct(./G01/H220): Failed to open directory: No such file or directory
//PHP 8.1.13 9.26.1
i want to find all folders that there are into for example G01 folder
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying to create an image that changes dependent on the genre grabbed from an icecast server, I am pretty sure I have the base code correct I think I've just incorrectly inputted the PHP variable.
<?php
$stats = $core->radioInfo( "http://http://sc.onlyhabbo.net:8124/status-json.xsl" );
?>
<img src=http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif/>
is the full code. Have I inputted the PHP variable incorrectly
Where are the quotes in your Html?
<img src="http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif"/>
UPDATE EVERYBODY
This is now resolved, I decided to go down the CURL route for this, and at first it didn't work until my host raised our CloudLinux Process Limit. I am unsure what the actual issue with this code was, but the CURL route works fine. Thank you for any answers
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I apologise in advance, I have googled & stackoverflow'd this and cannot get to the correct answer I need.
I have the following;
if ($radiobutton == "1"){
require ("/test/_testpage1.php");
}
radiobutton 2 also doing the same but going to testpage2.php instead. Neither of this is working. But if i move testpage1.php OUT of the /test/ folder it works perfectly fine just in public_html.
if ($radiobutton == "1"){
require ("_testpage1.php");
}
The above works fine, but in the interest in keeping things tidy & easier for me to manage I wanted to put things in folders.
PLEASE may somebody support on something I am quite clearly missing?
if your html root is /var/www/html (for example) when you try to require('/test/somefile.php') are trying to open in /test/ folder not in /var/www/html/test/
you can try this code?
/* without "/" */
require ("test/_testpage1.php");
I think it's more safe to use fullpath than relative path, maybe something like :
require 'FULLPATH.DS.testpage2.php'
We can debug it more easily rather than relative path
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
When I try to require a file into my HTML, my web page isn't loading anymore.
The file I want to require is empty so it isn't a scripting error.
require_once('required/dbClass.php');
session_start();
$_SESSION['user'] = 'Test User';
$testing=true;
This code above is working just fine and my page is loading as it is supposed to.
But when I try the next code, my page isn't loading anymore
require 'config.php';
require_once('required/dbClass.php');
session_start();
$_SESSION['user'] = 'Test User';
$testing=true;
I don't know what's wrong, I've tried getting an error with error_reporting(E_ALL); but that doesn't display anything.
Did I do something wrong?
Config.php was in a different directory
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am in the process of incorporating a Blog Posts section in my website.
However I am receiving an error message on the New Post page which I am unsure of the cause of.
Any help would be greatly appreciated.
I have received the above two Warning Error messages above.
I have also covered parts of the directory because they show names.
This is what the code looks like at the line specified.
<?php
include "cms/posts.php";
?>
Line 155 is the middle line of code.
If there is any more information which is required please let me know.
Thanks!
Reply to comment 1: Hi, I'm not sure why it is trying to open that file as I've never seen or heard of the file "usr/lib/php:/usr/local/lib/php".
Use this code and make sure the file exists:
<?php
include __DIR__ . "/cms/posts.php"; // PHP >= 5.3
include dirname(__FILE__) . "/cms/posts.php"; // PHP < 5.3
?>