When I send a photo to update the profile on the system, it returns the following fault: move_uploaded_file (/isequi/public/assets/img/user_pic/062701-20160807-suicida.jpg): failed to open stream: No such file or directory in C: \ xampp \ htdocs \ isequi \ sys \ class \ user.php
The environment for testing is windows 7 with xampp.
Code used:
$this->picName = basename($_FILES['userPicture']['name']);
$this->picExtension = pathinfo($this->picName, PATHINFO_EXTENSION);
$this->picSize = round($_FILES['userPicture']['size'] / 1000);
if($this->picSize == 0) {
$functions -> generateJsonMsg('selectPicture', null, null, null, $message->message['selectPicture']);
}
if($this->picSize > 100) {
$functions -> generateJsonMsg('fileIsTooLarge', null, null, null, $message->message['fileIsTooLarge']);
}
$functions -> isInArray($this->picExtension, $this->arrayPictureExtensionPermitted, 'extensionNotAllowed', $message->message['extensionNotAllowed']);
$this->picName = date('sih-Ymd').'-'.$this->picName;
$this->picNameDirectory = '/webpage/public/assets/img/user_pic/'.$this->picName;
if(move_uploaded_file($_FILES['userPicture']['tmp_name'], $this->picNameDirectory)) {
try {
$this->conn = parent::getconnection();
$this->pQuery = $this->conn->prepare( 'update user_detail '.
'set ud_picture=:picName '.
'where fk_user_id=:sessionId '.
'limit 1' );
$this->pQuery->execute(array( ':picName' => $this->picName,
':sessionId' => $session -> sessionId() ));
if($this->pQuery->errorCode() == 0) {
$functions -> generateJsonMsg('success', null, null, null, $message->message['iconSuccess']);
}
else {
throw new Exception();
}
}
catch(Exception $e) {
$tException = new tException();
$tException -> newException($e->getMessage(), $e->getFile(), $e->getLine(), $e->getTraceAsString());
}
}