vendredi 7 février 2020

Image file is not created in folder

I need to store image in my folder with path project/public/uploads. My uploadImage function catch in parameter image, but file is not created.

public function uploadImage($image)
{
    $random = Str::random(10);
    if($image == null) { return; }
    $this->removeImage();
    $filename = $random . '.' . $image->extension();
    $image->storeAs('uploads', $filename);
    $this->image = $filename;
    $this->save();
}

dd($image) show this

Illuminate\Http\UploadedFile {#270 ▼
  -test: false
  -originalName: "korabl_more_zakat_luna_63381_1920x1080.jpg"
  -mimeType: "image/jpeg"
  -error: 0
  #hashName: null
  path: "/tmp"
  filename: "phpfJOzTp"
  basename: "phpfJOzTp"
  pathname: "/tmp/phpfJOzTp"
  extension: ""
  realPath: "/tmp/phpfJOzTp"
  aTime: 2020-02-07 18:51:11
  mTime: 2020-02-07 18:51:11
  cTime: 2020-02-07 18:51:11
  inode: 34603072
  size: 425567
  perms: 0100600
  owner: 1000
  group: 1000
  type: "file"
  writable: true
  readable: true
  executable: false
  file: true
  dir: false
  link: false
}

Maybe it's has a meaning i'm using Linux OS, but my access right tuned for creating files in my project folder.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire