0

My Project Works Perfectly On Local Server But After I Have Upload It To Public Server . All Add Images Functions Give Me Same Error

Can't write image data to path (upload/.... I Am Using Laravel 8

here is my code when i add brand image

$image = $request->file('brand_image');
        $name_gen = hexdec(uniqid()).'.'.$image->getClientOriginalExtension();
        Image::make($image)->resize(300,300)->save('upload/brand/'.$name_gen);
        $save_url = 'upload/brand/'.$name_gen;

    Brand::insert([
        'brand_name_en' => $request->brand_name_en,
        'brand_name_ar' => $request->brand_name_ar,
        'brand_slug_en' => strtolower(str_replace(' ', '-',$request->brand_name_en)),
        'brand_slug_ar' => str_replace(' ', '-',$request->brand_name_ar),
        'brand_image' => $save_url,
ALAA ELDIN
  • 59
  • 1
  • 1
  • 9

1 Answers1

0

If you haven't created your path's folder, you will get that error. You need to create first it.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 10 '22 at 06:06
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33122508) – David Ansermot Nov 11 '22 at 09:40