mozew's avatar
Level 6

The file "C:\xampp\tmp\php1D5F.tmp" does not exist

I after install

composer require intervention/image

I want to upload image and after submit a form, I get this error.

The file "C:\xampp\tmp\php1D5F.tmp" does not exist

public function store(ArticleRequest $request)
{
    auth()->loginUsingId(1);
    $imagesUrl = $this->uploadImages($request->file('images'));

    $article = auth()->user()->article()->create(array_merge($request->all(), ['images' => $imagesUrl]));
    $article->categories()->attach(request('category'));


    return redirect(route('articles.index'));
}

I tried Change the code:

    $imagesUrl = $this->uploadImages($request->file('images'));
    return $imagesUrl;

It displaied return $imagesUrl well.

images  
300 "/upload/images/2018/300_tvto.jpg"
600 "/upload/images/2018/600_tvto.jpg"
900 "/upload/images/2018/900_tvto.jpg"
original    "/upload/images/2018/tvto.jpg"
thumb   "/upload/images/2018/300_tvto.jpg"

I think problem from array_merge

So what's the solution?

0 likes
6 replies
Hamelraj's avatar

try $file = $file->move(url('/upload/images/'.$year) , $filename);

mozew's avatar
Level 6

I get this error

Unable to create the "http://localhost:7000/upload/images/2018" directory

This error occurred in following lines:

$imagesUrl = $this->uploadImages($request->file('images'));

and

$file = $file->move(url('/upload/images/'.$year) , $filename);

Thanks for answer.

mozew's avatar
Level 6

OK, What is the solution and how to change it?

jlrdw's avatar

OK, What is the solution and how to change it?

@Cronix clearly stated how to fix it.

Change

$imagePath = "/upload/images/{$year}/";

to full qualified image path.

Not url

Please or to participate in this conversation.