dimanche 4 avril 2021

500 Server Error: I can't upload in save method

 if ($files = $request->file('cv_document')) {
            
            // Define upload path
            $directory = 'assets/front/files/'; // upload path
            // Upload Orginal Image           
            $profileImage = date('YmdHis') . "." . $files->getClientOriginalExtension();
            $files->move($directory, $profileImage);

            $data= "$profileImage";
            // Save In Database
            try {
                // Validate the value...
                $task = new Cvdetail;
                $task->username = $request->username;
                $task->email = $request->email;          
                $task->mobile = $request->mobile;
                $task->cv_document = $data;
                $task->save();
            } catch (Exception $e) {
                print_r($e);   
                return false;
            }
            
 
        }

//model given below
namespace App;

use Illuminate\Database\Eloquent\Model;

class Cvdetail extends Model
{
    
 
    public $table="cvdetails";
    public $timestamps=false;
}    


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire