У меня проблемы с этой функцией, я не могу передать свой файл -> когда файл загружен в конечное местоположение -> Что я пропустил:
Неисправность Функция:
public function imageUpload(){
$this->bExisting = false;
$location = "includes/images/Gallery/";
$target = $_FILES['ImagePath']['name'];
move_uploaded_file($_FILES['ImagePath']['tmp_name'], $location . $_FILES['ImagePath']['name'] );
}
Просмотр исходного кода
<form id='imageUpload' action='addimage.php' method= 'post' enctype='multipart/form-data'>
<fieldset>
<label for='ImageName'>Image:</label>
<input type='text' name='ImageName' id='ImageName' value='' onblur=''/>
<input type='hidden' name='MAX_FILE_SIZE' value='1000000' />
<label for='ImagePath'>Image Path:</label>
<input type='file' name='ImagePath' id='ImagePath' value='' onblur=''/><input name='submit' id = 'submit' type='submit' value='Image Upload' />
</fieldset>
Просмотр PHP:
<?php
ob_flush();
include('includes/session.php');
include('includes/header.php');
include('includes/class/class.form.php');
include('includes/class/class.page.php');
$iPageID = 1;
if(isset($_GET["PageID"])){
$iPageID = $_GET["PageID"];
}
$EditedPage = new Page();
$EditedPage->loadPage($iPageID);
$apageInformation = array(); // Information From DB Sticky
$apageInformation["Name"] = $EditedPage->getPageName();
$apageInformation["PageContent"] = $EditedPage->getPageContent();
$EditedPage->getPageContent();
//Sets form information
$Action = "editpage.php?PageID=".$iPageID; // Sets form file
$formEdit = new Form($Action, 'editPage','post','return CheckEditPage();','');
//Sets StickyData
$formEdit->setStickyData($apageInformation);
//Sets the Message
$Message = "";
//If it is set do below
if(isset($_POST["submit"])){
$formEdit->setStickyData($_POST);
$formEdit->checkNotEmpty("Name");
$formEdit->checkNotEmpty("PageContent");
if($formEdit->getValid() == true){
$EditedPage->setPageName = $database->escape_value($_POST["Name"]);
$EditedPage->setPageContent = $database->escape_value($_POST["PageContent"]);
$EditedPage->updatePage();
$Message = "Page Updated";
}else{
$Message = "You Have An Error Mate";
}
}
$formEdit->openFieldset();
$formEdit->makeInputBox("Name","Name","CheckInput(this.id);");
$formEdit->makeTextArea("Content", "PageContent", "20","70", "CheckInput(this.id);");
$formEdit->makeSubmitButton("submit","Edit Page");
$formEdit->closeFieldset();
?>
<section class="left">
<h1 class="Heading">Edit Page</h1>
<p class="loginError"><?php echo $Message ?></p>
<?php echo $formEdit->getHTML(); ?>
</section> <!-- Section Left End -->
<section class="right">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</section><!-- Section Right End -->
<?php include('includes/footer.php')?>