0
When I send a photo to update the profile on the system, it returns the following failure: move_uploaded_file(/isequi/public/Assets/img/user_pic/062701-20160807-suicidal.jpg): failed to open stream: No such file or directory in C: xampp htdocs isequi sys class user.php
The test environment 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());
}
}
Are you sure that the one you want to delete is the one that was there before the update and that file exists in the path indicated in the error?
– Miguel
I did a test inserting an echo using $_FILES['userPicture']['tmp_name'] and checked if the temp file was there, and did not find the.tmp file. The Directive in question /webpage/public/Assets/img/user_pic/ exists
– RRV
That is not what you have to see, in the case of the question you would have to see whether
062701-20160807-suicida.jpg
exists in/isequi/public/assets/img/user_pic/
– Miguel
This is Miguel.. The file was not created in the folder. I changed the folder’s permission, but it keeps giving the same fault.
– RRV
It’s not the permissions problem.
No such file or directory in ...
is because there is no/062701-20160807-suicida.jpg
or the way is wrong– Miguel