Ronnyere's avatar

I am using the intervention image is this all working, my doubt and would like to remove the photos saved from the public folder not to be accessed by the URL or protect the access by the URL for security question would anyone know how to do?

This is my code ::

public function update_avatar(Request $request){
        // Controle do upload do usuário do avatar
        if($request->hasFile('avatar')){
            $avatar = $request->file('avatar');
            $filename = time() . '.' . $avatar->getClientOriginalExtension();
            Image::make($avatar)>resize(300, 300)>save( public_path('/uploads/avatars/' . $filename ) );
            $user = Auth::user();
            $user->avatar = $filename;
            $user->save();
        }
        return  view('profile', array('user' => Auth::user()) );
    }/fim da function para fazer upload de imagens/

0 likes
2 replies
Sensoray's avatar

You could randomize the filename, so that way they are protected and others can't guess at the filename to access it.

1 like

Please or to participate in this conversation.