-2

I have a problem when I want to upload a file to digital ocean, there is a 403 error, even though I'm sure the key, secret and endpoint are correct

this is my simple code

  $tes= Storage::disk('digitalocean')->putFileAs('url', request()->file('url'), time().'.'.$extension);
        dd($tes);
misry
  • 341
  • 2
  • 4
  • 14

1 Answers1

0
      if ($request->hasFile('url')) {
        $file = $request->file('url');
        $ext1 = $file->getClientOriginalExtension();
        
        // $st_random = str_random(10);
        //dd($file);
        $st_random = Str::random(10);
        $filename = $file->getClientOriginalName();
        $filename = explode(".", $filename);
        $ext = $ext1;
        $filename = $filename[0] . $st_random . "." . $ext;

        Storage::disk('digitalocean')->put('/' . $filename, File::get($file));
        $csv = 'digitalocean/' . $filename;
        

    }

note

use Storage;
use Str;
use File;

you have to try this file uploading . it may solve your problem .

Rakesh kumar Oad
  • 1,332
  • 1
  • 15
  • 24