vinubangs's avatar

How to upload file on another url folder

I am working on xampp localhost. I have a laravel setup. and I am uploading a file from my project to another laravel project.

public function cvupload(Request $request)
    {
		$this->validate($request,[
		'resume' => 'required|mimes:doc,pdf,docx'
		],
		[
		    'required' => 'This field is required',
		    'mimes' => 'Allowed only doc,pdf,docx',
		]);

		$image = $request->file('resume');
		$name = time().'.'.$image->getClientOriginalExtension();
		$destinationPath = 'http://example.com/adminapi/app/storage/uploads/';
		$image->move($destinationPath, $name);
		$resume_with_path = $destinationPath.$name;
}

But It gives error:

Symfony\Component\HttpFoundation\File\Exception\FileException Unable to create the directory.

0 likes
8 replies
Anishdhanka's avatar

it looks like permission issue to create directory . create directory "mkdir -p storage/uploads"

vinubangs's avatar

It should simply upload on that directory?

vinubangs's avatar

@michaloravec

Basically my project and other project both are in same server. Only project folder is different. I need to upload file from my project folder to another project folder. That is why I gave complete URL.

vinubangs's avatar

@michaloravec

I tried with in config/filesystem.php

I added custom code.



        'custom' => [
            'driver' => 'local',
            'root'   => '../ims_website',
        ],

in my controller.

$image = $request->file('resume');
$store  = Storage::disk('custom')->put($image, 'contents');

But not working.

error: League\Flysystem\Exception Impossible to create the root directory "../ims_website\E:/xampp/tmp".

Please or to participate in this conversation.