Im trying to have a function where a user can change their profile picture, im using S3 and when following the tutorial im getting problems.
Here is a copy of my controller.
<?php namespace App\Http\Controllers;
use App\User;
use Session;
use Input;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
use Illuminate\Contracts\Filesystem\Filesystem;
class UserController extends Controller
{
public function postChangeImg(Request $request, Filesystem $filesystem)
{
$user = User::where('email', $request->user());
$file = Input::file('file');
$filesystem->put('15.png', $file);
dd('done');
}
}
I named it 15.png for a test, and in the s3 bucket the image is corrupted and only 14bytes in size regardless of the image that i upload.
I was looking into it a little deeper and renamed the image from i downloaded from s3 to .txt at the end and opened it with notepad and here are the contents of it
This means you are not uploading the correct information of the image ;) I think you are uploading the temp name of the file instead of the file itself
yeah becuase if i move the file to a folder and rename it, i go to upload it and the information changes, how would i upload the contents of the image then?