I would like to create a directory but I got this error :
ErrorException in Filesystem.php line 390: mkdir(): No such file or directoryErrorException in Filesystem.php line 390: mkdir(): No such file or directory
in Filesystem.php line 390
at HandleExceptions->handleError('2', 'mkdir(): No such file or directory', 'C:\xampp\htdocs\yatan\yatan\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php', '390', array('path' => 'C:\xampp\htdocs\yatan\yatan\public/assets/images/projects/1/1476592434/', 'mode' => '511', 'recursive' => false, 'force' => false))
my code :
$to_main_image = time();
$path = 'assets/images/projects/'.$user_id.'/'.$to_main_image.'/';
File::makeDirectory(public_path().'/'.$path,0777);
Change the line
File::makeDirectory(public_path().'/'.$path,0777);
to
File::makeDirectory(public_path().'/'.$path,0777,true);
So that the sub-directories are also created.
if using laravel 5.8 then try this out
go to vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php and find prepareCache function and edit line no 247 -
if (!mkdir($cacheDir))
to
if (!mkdir($cacheDir,0777,true))
Adding the code snippet as well.
private function prepareCache($nsKey)
{
$cacheDir = $this->path.'/'.$nsKey;
if (!is_dir($cacheDir)) {
if (!mkdir($cacheDir,0777,true)) {
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
}
$this->keys[$nsKey] = [];
}
}
Related
// controller
$file = $request->file('video');
$uri = Vimeo::upload($file, [
'name' => 'test',
'description' => 'easy upload'
]);
return $uri;
file_put_contents(): Write of 207 bytes failed with errno=13 Permission denied
The process running the app needs write permission to the temp directory (defaults to /tmp) for TusUpload to work.
For Laravel $request->file to work, the process also needs write permission to the file directory (this defaults to public/uploads in the root directory of the app, but can be configured)
I get the follow error:
The "C:\xampp\tmp\php49D8.tmp" file does not exist or is not readable.
But the file is copied successfully
My controller code is:
$fileResult=$file->move(self::UPLOAD_DIR, $name_file);
if(!$fileResult){
$result = array("status" => "500",
"error"=> array("error" => "Error in the file move"));
return response(json_encode( $result ), $result["status"])
->header("Content-Type", "application/json");
}
Screenshot: here
Why can be the problem?
Call $validator->fails() can delete uploading file
use
$file = $request->file('file');//get your file
$fileResult=$file->move(self::UPLOAD_DIR, $file->getClientOriginalName());
I am using guzzle to downlaod file from url and save it into my storage.
So I have a code look like this
$response = $this->client->request('GET', $model->url, [
'stream' => true
]);
$body = $response->getBody();
while (!$body->eof()) {
Storage::append($this->filePath, $body->read(1024));;
}
but when I open the folder where my file is located, I see that the file size is changing and sometimes it is zero. So in the end I am getting a invalid file.
How can I solve this problem?
I am using HMVC codeigniter 3. I have a folder called admin under and in that folder I have a subfolder called client. In my config file, i have set up the module path like this;
$config['modules_locations'] = array(
APPPATH.'modules/' => '../modules/',
APPPATH.'modules/admin/' => '../modules/admin/',
);
Now, the problem is, its loadig my client controller but its not loading my entites. it is showing me the following error;
> An uncaught Exception was encountered
>
> Type: Doctrine\ORM\Query\QueryException
>
> Message: [Semantical Error] line 0, col 109 near 'entities\AppClient':
> Error: Class 'entities\AppClient' is not defined.
Please help me to solve this issue..This client module works fine, if i moved it from sub module to only modules folder
solved it...Add the following function in doctorine.php
private function _recursiveDir(&$array, $directory)
{
$scanned_dir = array_diff(scandir($directory), array('..', '.'));
sort($scanned_dir);
$subModules = array(
"admin"
);
foreach ($scanned_dir as $module) {
if (is_dir($directory.$module."/models")) {
$array[] = $directory.$module."/models/doctrine/entities";
} else if (in_array($module, $subModules)) {
$this->_recursiveDir($array, $directory.$module."/");
}
}
}
I wanted the Laravel 4.1 package to be at the root of a particular web server so I took it out of it's "laravel" dir and moved it.
Used to be in: C:\www\mysite.dev\laravel
Now it is in: C:\www\mysite.dev
When I run composer update it chokes producing the error:
{"error":{"type":"ErrorException","message":"mkdir(): No such file or directory","file":"C:\\www\\mysite.dev\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php","line":302}}
How can I configure composer.json to compensate for this change?
It seems like problem with permissions.
Line 302 of Filesystem.php is the following (in bold):
public function makeDirectory($path, $mode = 0777, $recursive = false, $force = false)
{
if ($force)
{
return #mkdir($path, $mode, $recursive);
}
else
{
302 return mkdir($path, $mode, $recursive);
}
}