PHP code example of dillingham / interacts-with-uploads

1. Go to this page and download the library: Download dillingham/interacts-with-uploads library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dillingham / interacts-with-uploads example snippets


use \Dillingham\InteractsWithUploads;

public function store(CreateProfileRequest $request) 
{
    $request->upload('banner');

    $profile = Profile::create($request->validated());

    return redirect()->route('profiles.show', $profile);
}

public function update(UpdateProfileRequest $request, Profile $profile)
{
    $request->upload('profile.banner');

    $profile->update($request->validated());

    return redirect()->route('profiles.show', $profile);
}

public function update(UpdateProfileRequest $request, Profile $profile)
{
    $request->updateUpload($profile, 'banner');

    $profile->update($request->validated());

    return redirect()->route('profiles.show', $profile);
}

$request->upload('banner', 'uploads', 'public');