gpt4 book ai didi

php - 警告 : move_uploaded_file(): open_basedir restriction in effect. File() 不在允许的路径内:

转载 作者:行者123 更新时间:2023-11-29 12:00:28 25 4
gpt4 key购买 nike

我有一个文件夹,其中包含将标题、摘要、内容、日期和图像上传到数据库的事件。它工作正常,所以我复制该文件夹,只更改数据库表以对文件夹折扣执行相同操作,但它不起作用(它不是 php.ini open_basedir 限制,因为在其他文件夹中它工作正常),它当我上传折扣时显示此错误:

   Warning: move_uploaded_file(): open_basedir restriction in effect. File() is not within the allowed path(s): (/home/organizi/:/tmp/:/var/tmp/:/usr/local/php54/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/lib/php/) in /home/organizi/domains/organizing-erasmus.es/public_html/descuentos/classes/Article.php on line 112

Fatal error: Article::storeUploadedImage(): Couldn't move uploaded file. in /home/organizi/domains/organizing-erasmus.es/public_html/descuentos/classes/Article.php on line 113

函数存储上传图片:

public function storeUploadedImage( $image ) {

if ( $image['error'] == UPLOAD_ERR_OK )
{
// Does the Article object have an ID?
if ( is_null( $this->id ) ) trigger_error( "Article::storeUploadedImage(): Attempt to upload an image for an Article object that does not have its ID property set.", E_USER_ERROR );

// Delete any previous image(s) for this article
$this->deleteImages();

// Get and store the image filename extension
$this->imageExtension = strtolower( strrchr( $image['name'], '.' ) );

// Store the image

$tempFilename = trim( $image['tmp_name'] );

if ( is_uploaded_file ( $tempFilename ) ) {
if ( !( move_uploaded_file( $tempFilename, $this->getImagePath() ) ) )
trigger_error( "Article::storeUploadedImage(): Couldn't move uploaded file.", E_USER_ERROR );

if ( !( chmod( $this->getImagePath(), 0666 ) ) ) trigger_error( "Article::storeUploadedImage(): Couldn't set permissions on uploaded file.", E_USER_ERROR );
}

// Get the image size and type
$attrs = getimagesize ( $this->getImagePath() );
$imageWidth = $attrs[0];
$imageHeight = $attrs[1];
$imageType = $attrs[2];

// Load the image into memory
switch ( $imageType ) {
case IMAGETYPE_GIF:
$imageResource = imagecreatefromgif ( $this->getImagePath() );
break;
case IMAGETYPE_JPEG:
$imageResource = imagecreatefromjpeg ( $this->getImagePath() );
break;
case IMAGETYPE_PNG:
$imageResource = imagecreatefrompng ( $this->getImagePath() );
break;
default:
trigger_error ( "Article::storeUploadedImage(): Unhandled or unknown image type ($imageType)", E_USER_ERROR );
}

// Copy and resize the image to create the thumbnail
$thumbHeight = intval ( $imageHeight / $imageWidth * ARTICLE_THUMB_WIDTH );
$thumbResource = imagecreatetruecolor ( ARTICLE_THUMB_WIDTH, $thumbHeight );
imagecopyresampled( $thumbResource, $imageResource, 0, 0, 0, 0, ARTICLE_THUMB_WIDTH, $thumbHeight, $imageWidth, $imageHeight );

// Save the thumbnail
switch ( $imageType ) {
case IMAGETYPE_GIF:
imagegif ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ) );
break;
case IMAGETYPE_JPEG:
imagejpeg ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ), JPEG_QUALITY );
break;
case IMAGETYPE_PNG:
imagepng ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ) );
break;
default:
trigger_error ( "Article::storeUploadedImage(): Unhandled or unknown image type ($imageType)", E_USER_ERROR );
}

$this->update();
}
}

Admin.php 文件:

<?php

require( "config.php" );
session_start();
$action = isset( $_GET['action'] ) ? $_GET['action'] : "";
$username = isset( $_SESSION['username'] ) ? $_SESSION['username'] : "";

if ( $action != "login" && $action != "logout" && !$username ) {
login();
exit;
}

switch ( $action ) {
case 'login':
login();
break;
case 'logout':
logout();
break;
case 'newArticle':
newArticle();
break;
case 'editArticle':
editArticle();
break;
case 'deleteArticle':
deleteArticle();
break;
default:
listArticles();
}


function login() {

$results = array();
$results['pageTitle'] = "Admin Login | Widget News";

if ( isset( $_POST['login'] ) ) {

// User has posted the login form: attempt to log the user in

if ( $_POST['username'] == ADMIN_USERNAME && $_POST['password'] == ADMIN_PASSWORD ) {

// Login successful: Create a session and redirect to the admin homepage
$_SESSION['username'] = ADMIN_USERNAME;
header( "Location: admin.php" );

} else {

// Login failed: display an error message to the user
$results['errorMessage'] = "Incorrect username or password. Please try again.";
require( TEMPLATE_PATH . "/admin/loginForm.php" );
}

} else {

// User has not posted the login form yet: display the form
require( TEMPLATE_PATH . "/admin/loginForm.php" );
}

}


function logout() {
unset( $_SESSION['username'] );
header( "Location: admin.php" );
}


function newArticle() {

$results = array();
$results['pageTitle'] = "Nuevo Evento";
$results['formAction'] = "newArticle";

if ( isset( $_POST['saveChanges'] ) ) {

// User has posted the article edit form: save the new article
$article = new Article;
$article->storeFormValues( $_POST );
$article->insert();
if ( isset( $_FILES['image'] ) ) $article->storeUploadedImage( $_FILES['image'] );
header( "Location: admin.php?status=changesSaved" );

} elseif ( isset( $_POST['cancel'] ) ) {

// User has cancelled their edits: return to the article list
header( "Location: admin.php" );
} else {

// User has not posted the article edit form yet: display the form
$results['article'] = new Article;
require( TEMPLATE_PATH . "/admin/editArticle.php" );
}

}


function editArticle() {

$results = array();
$results['pageTitle'] = "Editar evento";
$results['formAction'] = "editArticle";

if ( isset( $_POST['saveChanges'] ) ) {

// User has posted the article edit form: save the article changes

if ( !$article = Article::getById( (int)$_POST['articleId'] ) ) {
header( "Location: admin.php?error=articleNotFound" );
return;
}

$article->storeFormValues( $_POST );
if ( isset($_POST['deleteImage']) && $_POST['deleteImage'] == "yes" ) $article->deleteImages();
$article->update();
if ( isset( $_FILES['image'] ) ) $article->storeUploadedImage( $_FILES['image'] );
header( "Location: admin.php?status=changesSaved" );

} elseif ( isset( $_POST['cancel'] ) ) {

// User has cancelled their edits: return to the article list
header( "Location: admin.php" );
} else {

// User has not posted the article edit form yet: display the form
$results['article'] = Article::getById( (int)$_GET['articleId'] );
require( TEMPLATE_PATH . "/admin/editArticle.php" );
}

}


function deleteArticle() {

if ( !$article = Article::getById( (int)$_GET['articleId'] ) ) {
header( "Location: admin.php?error=articleNotFound" );
return;
}

$article->deleteImages();
$article->delete();
header( "Location: admin.php?status=articleDeleted" );
}


function listArticles() {
$results = array();
$data = Article::getList();
$results['articles'] = $data['results'];
$results['totalRows'] = $data['totalRows'];
$results['pageTitle'] = "All Articles";

if ( isset( $_GET['error'] ) ) {
if ( $_GET['error'] == "articleNotFound" ) $results['errorMessage'] = "Error: evento no encontrado.";
}

if ( isset( $_GET['status'] ) ) {
if ( $_GET['status'] == "changesSaved" ) $results['statusMessage'] = "Cambios guardados.";
if ( $_GET['status'] == "articleDeleted" ) $results['statusMessage'] = "Evento eliminado.";
}

require( TEMPLATE_PATH . "/admin/listArticles.php" );
}

?>

classes/article.php file:

<?php

/**
* Class to handle articles
*/

class Article
{
// Properties

/**
* @var int The article ID from the database
*/
public $id = null;


/**
* @var string Full title of the article
*/
public $title = null;
public $title_eng = null;

/**
/**
* @var string The HTML content of the article
*/
public $content = null;
public $content_eng = null;

/**
* @var string The filename extension of the article's full-size and thumbnail images (empty string means the article has no image)
*/
public $imageExtension = "";


/**
* Sets the object's properties using the values in the supplied array
*
* @param assoc The property values
*/

public function __construct( $data=array() ) {
if ( isset( $data['id'] ) ) $this->id = (int) $data['id'];
if ( isset( $data['publicationDate'] ) ) $this->publicationDate = (int) $data['publicationDate'];
if ( isset( $data['publicationDate_fin'] ) ) $this->publicationDate_fin = (int) $data['publicationDate_fin'];
if ( isset( $data['title'] ) ) $this->title = $data['title'];
if ( isset( $data['title_eng'] ) ) $this->title_eng = $data['title_eng'];
if ( isset( $data['content'] ) ) $this->content = $data['content'];
if ( isset( $data['content_eng'] ) ) $this->content_eng = $data['content_eng'];
if ( isset( $data['imageExtension'] ) ) $this->imageExtension = $data['imageExtension'];
}


/**
* Sets the object's properties using the edit form post values in the supplied array
*
* @param assoc The form post values
*/

public function storeFormValues( $params ) {

// Store all the parameters
$this->__construct( $params );

// Parse and store the publication date
if ( isset($params['publicationDate']) ) {
$publicationDate = explode ( '-', $params['publicationDate'] );

if ( count($publicationDate) == 3 ) {
list ( $y, $m, $d ) = $publicationDate;
$this->publicationDate = mktime ( 0, 0, 0, $m, $d, $y );
}
}

// Parse and store the publication date
if ( isset($params['publicationDate_fin']) ) {
$publicationDate_fin = explode ( '-', $params['publicationDate_fin'] );

if ( count($publicationDate_fin) == 3 ) {
list ( $y, $m, $d ) = $publicationDate_fin;
$this->publicationDate_fin = mktime ( 0, 0, 0, $m, $d, $y );
}
}

}


/**
* Stores any image uploaded from the edit form
*
* @param assoc The 'image' element from the $_FILES array containing the file upload data
*/

public function storeUploadedImage( $image ) {

if ( $image['error'] == UPLOAD_ERR_OK )
{
// Does the Article object have an ID?
if ( is_null( $this->id ) ) trigger_error( "Article::storeUploadedImage(): Attempt to upload an image for an Article object that does not have its ID property set.", E_USER_ERROR );

// Delete any previous image(s) for this article
$this->deleteImages();

// Get and store the image filename extension
$this->imageExtension = strtolower( strrchr( $image['name'], '.' ) );

// Store the image

$tempFilename = trim( $image['tmp_name'] );

if ( is_uploaded_file ( $tempFilename ) ) {
if ( !( move_uploaded_file( $tempFilename, $this->getImagePath() ) ) )
trigger_error( "Article::storeUploadedImage(): Couldn't move uploaded file.", E_USER_ERROR );

if ( !( chmod( $this->getImagePath(), 0666 ) ) ) trigger_error( "Article::storeUploadedImage(): Couldn't set permissions on uploaded file.", E_USER_ERROR );
}

// Get the image size and type
$attrs = getimagesize ( $this->getImagePath() );
$imageWidth = $attrs[0];
$imageHeight = $attrs[1];
$imageType = $attrs[2];

// Load the image into memory
switch ( $imageType ) {
case IMAGETYPE_GIF:
$imageResource = imagecreatefromgif ( $this->getImagePath() );
break;
case IMAGETYPE_JPEG:
$imageResource = imagecreatefromjpeg ( $this->getImagePath() );
break;
case IMAGETYPE_PNG:
$imageResource = imagecreatefrompng ( $this->getImagePath() );
break;
default:
trigger_error ( "Article::storeUploadedImage(): Unhandled or unknown image type ($imageType)", E_USER_ERROR );
}

// Copy and resize the image to create the thumbnail
$thumbHeight = intval ( $imageHeight / $imageWidth * ARTICLE_THUMB_WIDTH );
$thumbResource = imagecreatetruecolor ( ARTICLE_THUMB_WIDTH, $thumbHeight );
imagecopyresampled( $thumbResource, $imageResource, 0, 0, 0, 0, ARTICLE_THUMB_WIDTH, $thumbHeight, $imageWidth, $imageHeight );

// Save the thumbnail
switch ( $imageType ) {
case IMAGETYPE_GIF:
imagegif ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ) );
break;
case IMAGETYPE_JPEG:
imagejpeg ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ), JPEG_QUALITY );
break;
case IMAGETYPE_PNG:
imagepng ( $thumbResource, $this->getImagePath( IMG_TYPE_THUMB ) );
break;
default:
trigger_error ( "Article::storeUploadedImage(): Unhandled or unknown image type ($imageType)", E_USER_ERROR );
}

$this->update();
}
}


/**
* Deletes any images and/or thumbnails associated with the article
*/

public function deleteImages() {

// Delete all fullsize images for this article
foreach (glob( ARTICLE_IMAGE_PATH . "/" . IMG_TYPE_FULLSIZE . "/" . $this->id . ".*") as $filename) {
if ( !unlink( $filename ) ) trigger_error( "Article::deleteImages(): Couldn't delete image file.", E_USER_ERROR );
}

// Delete all thumbnail images for this article
foreach (glob( ARTICLE_IMAGE_PATH . "/" . IMG_TYPE_THUMB . "/" . $this->id . ".*") as $filename) {
if ( !unlink( $filename ) ) trigger_error( "Article::deleteImages(): Couldn't delete thumbnail file.", E_USER_ERROR );
}

// Remove the image filename extension from the object
$this->imageExtension = "";
}


/**
* Returns the relative path to the article's full-size or thumbnail image
*
* @param string The type of image path to retrieve (IMG_TYPE_FULLSIZE or IMG_TYPE_THUMB). Defaults to IMG_TYPE_FULLSIZE.
* @return string|false The image's path, or false if an image hasn't been uploaded
*/

public function getImagePath( $type=IMG_TYPE_FULLSIZE ) {
return ( $this->id && $this->imageExtension ) ? ( ARTICLE_IMAGE_PATH . "/$type/" . $this->id . $this->imageExtension ) : false;
}



/**
* Returns an Article object matching the given article ID
*
* @param int The article ID
* @return Article|false The article object, or false if the record was not found or there was a problem
*/

public static function getById( $id ) {
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$sql = "SELECT *, UNIX_TIMESTAMP(publicationDate) AS publicationDate, UNIX_TIMESTAMP(publicationDate_fin) AS publicationDate_fin FROM descuentos WHERE id = :id";
$st = $conn->prepare( $sql );
$st->bindValue( ":id", $id, PDO::PARAM_INT );
$st->execute();
$row = $st->fetch();
$conn = null;
if ( $row ) return new Article( $row );
}


/**
* Returns all (or a range of) Article objects in the DB
*
* @param int Optional The number of rows to return (default=all)
* @param string Optional column by which to order the descuentos (default="publicationDate DESC")
* @return Array|false A two-element array : results => array, a list of Article objects; totalRows => Total number of descuentos
*/

public static function getList( $numRows=1000000, $order="id DESC" ) {
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(publicationDate) AS publicationDate, UNIX_TIMESTAMP(publicationDate_fin) AS publicationDate_fin FROM descuentos
ORDER BY " . mysql_escape_string($order) . " LIMIT :numRows";

$st = $conn->prepare( $sql );
$st->bindValue( ":numRows", $numRows, PDO::PARAM_INT );
$st->execute();
$list = array();

while ( $row = $st->fetch() ) {
$article = new Article( $row );
$list[] = $article;
}

// Now get the total number of descuentos that matched the criteria
$sql = "SELECT FOUND_ROWS() AS totalRows";
$totalRows = $conn->query( $sql )->fetch();
$conn = null;
return ( array ( "results" => $list, "totalRows" => $totalRows[0] ) );
}



/**
* Inserts the current Article object into the database, and sets its ID property.
*/

public function insert() {

// Does the Article object already have an ID?
if ( !is_null( $this->id ) ) trigger_error ( "Article::insert(): Attempt to insert an Article object that already has its ID property set (to $this->id).", E_USER_ERROR );

// Insert the Article
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$sql = "INSERT INTO descuentos ( publicationDate, publicationDate_fin, title, title_eng, content, content_eng, imageExtension ) VALUES ( FROM_UNIXTIME(:publicationDate), FROM_UNIXTIME(:publicationDate_fin), :title, :title_eng, :content, :content_eng, :imageExtension )";
$st = $conn->prepare ( $sql );
$st->bindValue( ":publicationDate", $this->publicationDate, PDO::PARAM_INT );
$st->bindValue( ":publicationDate_fin", $this->publicationDate_fin, PDO::PARAM_INT );
$st->bindValue( ":title", $this->title, PDO::PARAM_STR );
$st->bindValue( ":title_eng", $this->title_eng, PDO::PARAM_STR );
$st->bindValue( ":content", $this->content, PDO::PARAM_STR );
$st->bindValue( ":content_eng", $this->content_eng, PDO::PARAM_STR );
$st->bindValue( ":imageExtension", $this->imageExtension, PDO::PARAM_STR );
$st->execute();
$this->id = $conn->lastInsertId();
$conn = null;
}


/**
* Updates the current Article object in the database.
*/

public function update() {

// Does the Article object have an ID?
if ( is_null( $this->id ) ) trigger_error ( "Article::update(): Attempt to update an Article object that does not have its ID property set.", E_USER_ERROR );

// Update the Article
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$sql = "UPDATE descuentos SET publicationDate=FROM_UNIXTIME(:publicationDate), publicationDate_fin=FROM_UNIXTIME(:publicationDate_fin), title=:title, title_eng=:title_eng, content=:content, content_eng=:content_eng, imageExtension=:imageExtension WHERE id = :id";
$st = $conn->prepare ( $sql );
$st->bindValue( ":publicationDate", $this->publicationDate, PDO::PARAM_INT );
$st->bindValue( ":publicationDate_fin", $this->publicationDate_fin, PDO::PARAM_INT );
$st->bindValue( ":title", $this->title, PDO::PARAM_STR );
$st->bindValue( ":title_eng", $this->title_eng, PDO::PARAM_STR );
$st->bindValue( ":content", $this->content, PDO::PARAM_STR );
$st->bindValue( ":content_eng", $this->content_eng, PDO::PARAM_STR );
$st->bindValue( ":imageExtension", $this->imageExtension, PDO::PARAM_STR );
$st->bindValue( ":id", $this->id, PDO::PARAM_INT );
$st->execute();
$conn = null;
}


/**
* Deletes the current Article object from the database.
*/

public function delete() {

// Does the Article object have an ID?
if ( is_null( $this->id ) ) trigger_error ( "Article::delete(): Attempt to delete an Article object that does not have its ID property set.", E_USER_ERROR );

// Delete the Article
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$st = $conn->prepare ( "DELETE FROM descuentos WHERE id = :id LIMIT 1" );
$st->bindValue( ":id", $this->id, PDO::PARAM_INT );
$st->execute();
$conn = null;
}

}

?>

编辑文章文件:

<?php include "templates/include/header.php" ?>

<script>

// Prevents file upload hangs in Mac Safari
// Inspired by http://airbladesoftware.com/notes/note-to-self-prevent-uploads-hanging-in-safari

function closeKeepAlive() {
if ( /AppleWebKit|MSIE/.test( navigator.userAgent) ) {
var xhr = new XMLHttpRequest();
xhr.open( "GET", "/ping/close", false );
xhr.send();
}
}

</script>
<script type="text/javascript" src="http://organizing-erasmus.es/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "#content",
plugins : 'link table insertdatetime textcolor',
toolbar: "forecolor backcolor save",
language: "es",
tools: "inserttable"
});
tinymce.init({
selector: "#content_eng",
plugins : 'link table insertdatetime textcolor',
toolbar: "forecolor backcolor save",
language: "es",
tools: "inserttable"
});
</script>
<div id="adminHeader">
<h2>Panel de administración de descuentos</h2>
<p>Estás identificado como <b><?php echo htmlspecialchars( $_SESSION['username']) ?></b>. <a href="admin.php?action=logout"?>Salir</a></p>
</div>

<h1><?php echo $results['pageTitle']?></h1>

<form action="admin.php?action=<?php echo $results['formAction']?>" method="post" enctype="multipart/form-data" onsubmit="closeKeepAlive()">
<input type="hidden" name="articleId" value="<?php echo $results['article']->id ?>"/>

<?php if ( isset( $results['errorMessage'] ) ) { ?>
<div class="errorMessage"><?php echo $results['errorMessage'] ?></div>
<?php } ?>

<ul>

<li>
<label for="title">Título del descuento</label>
<input type="text" name="title" id="title" placeholder="Nombre del descuento" autofocus maxlength="15" value="<?php echo htmlspecialchars( $results['article']->title )?>" required/>
</li>

<li>
<label for="title_eng">Título del descuento (inglés)</label>
<input type="text" name="title_eng" id="title_eng" placeholder="Nombre del descuento en inglés" maxlength="15" value="<?php echo htmlspecialchars( $results['article']->title_eng )?>" />
</li>

<li>
<label for="content" class="content_label">Contenido del descuento</label>
<textarea name="content" id="content" placeholder="Contenido HTML del descuento" maxlength="100000" style="height: 30em;"><?php echo htmlspecialchars( $results['article']->content )?></textarea>
</li>

<li>
<label for="content_eng" class="content_label">Contenido del descuento (inglés)</label>
<textarea name="content_eng" id="content_eng" placeholder="Contenido HTML del descuento en inglés" maxlength="100000" style="height: 30em;"><?php echo htmlspecialchars( $results['article']->content_eng )?></textarea>
</li>


<li>
<label for="publicationDate">Fecha de inicio</label>
<input type="date" name="publicationDate" id="publicationDate" placeholder="YYYY-MM-DD" maxlength="10" value="<?php echo $results['article']->publicationDate ? date( "Y-m-d", $results['article']->publicationDate ) : "" ?>" required/>
</li>

<li>
<label for="publicationDate_fin">Fecha de fin</label>
<input type="date" name="publicationDate_fin" id="publicationDate_fin" required="" placeholder="YYYY-MM-DD" maxlength="10" value="<?php echo $results['article']->publicationDate_fin ? date( "Y-m-d", $results['article']->publicationDate_fin ) : "" ?>" required/>
</li>



<?php if ( $results['article'] && $imagePath = $results['article']->getImagePath() ) { ?>
<li>
<label>Imagen actual</label>
<img id="articleImage" src="<?php echo $imagePath ?>" alt="Article Image" />
</li>

<li>
<label></label>
<input type="checkbox" name="deleteImage" id="deleteImage" value="yes"/ > <label for="deleteImage">Eliminar</label>
</li>
<?php } ?>

<li>
<label for="image">Nueva imagen</label>
<input type="file" name="image" id="image" placeholder="Choose an image to upload" maxlength="255"/>
</li>

</ul>

<div class="buttons">
<input type="submit" name="saveChanges" value="Guardar cambios" />
<input type="submit" formnovalidate name="cancel" value="Cancelar" />
</div>

</form>

<?php if ( $results['article']->id ) { ?>
<p><a href="admin.php?action=deleteArticle&amp;articleId=<?php echo $results['article']->id ?>" onclick="return confirm('Eliminar este descuento?')">Eliminar este descuento</a></p>
<?php } ?>

<?php include "templates/include/footer.php" ?>

Config.php 文件(路径图像):

define( "ARTICLE_IMAGE_PATH", "images/articles" );
define( "IMG_TYPE_FULLSIZE", "fullsize" );
define( "IMG_TYPE_THUMB", "thumb" );
define( "ARTICLE_THUMB_WIDTH", 400 );

最佳答案

阅读错误消息:

File() is not within the allowed path(s): (/home/organizi/:/tmp/:/var/tmp/:/usr/local/php54/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/lib/php/) in /home/organizi/domains/organizing-erasmus.es/public_html/descuentos/classes/Article.php on line 112

文件的路径应出现在错误消息的括号中,例如文件(/home/xxx/file.png)不在允许的路径内。这意味着您的文件路径为空,因此请检查您的 getImagePath 方法,我怀疑它返回 false 而不是您期望的路径。

关于php - 警告 : move_uploaded_file(): open_basedir restriction in effect. File() 不在允许的路径内:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32458081/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com