anonymouse703's avatar

Best way to upload file (.zip) into ubuntu pc (server)

Hello guys, I have little confusion on what is the best way to upload .zip file into ubuntu pc (server).

There are three suggestions from Laravel docs.

  1. By using SFTP
  2. By using S3
  3. By using FTP
  4. Rackspace

So far I already have UI and functions in my Upload Controller but not yet done because of that confusion.

My Controller:

index

public function index(){

        $data = File::all();

        return view('file-upload.index',compact('data'));

    }

create

 public function create(){

        return view('file-upload.create');
    }

store (not sure to this)

public function store(Request $request){

        $this->validate($request, [

            'filename' => 'required',
            'filename.*' => 'mimes:doc,pdf,docx,zip'

        ]);

        if($request->hasfile('filename'))
        {

           foreach($request->file('filename') as $file)
           {
                $name=$file->getClientOriginalName();
                /* get File Extension */
                // $extension = $file->getClientOriginalExtension();
                $file->move(public_path().'/files/', $name);  
                $data[] = $name;  
           }
        }

        $file= new File();
        $file->filename=json_encode($data);
        
       
       $file->save();

       session()->flash('save', 'Your files has been successfully added');

       return view('file-upload.index');
    }

My problem now is the proper way to upload .zip in the ubuntu pc (server) of which of the three above mentioned is better.

Thank you.

Anonymouse703

0 likes
0 replies

Please or to participate in this conversation.