dimanche 24 décembre 2017

laravel images validation not work

i make validation on images but not working and back to page and input are empty any error . in code ? code

    $this->validate($request, [
         'image' => 'image|mimes:jpeg,jpg,png,gif',
    ]); 
    $ADS = new ADS; 
    $ADS->title = Input::get('title');
    $ADS->detals = Input::get('detals');
    $ADS->city = Input::get('city');
    $ADS->country = Input::get('country');
    $ADS->id_user = Auth::user()->id;
    $ADS->type= Input::get('type'); 
    $ADS->years= Input::get('years'); 
    $ADS->save(); 

    if(Input::hasFile('image')){
        foreach ($request->file('image') as $file){
            $name = $file->getClientOriginalName();
            $picture = date('His').$name;
            $myimg = $file->move('uploads',$picture);
            $Photos = new Photos; 
            $Photos->id_ads = $ADS->id;
            $Photos->type = 1;  
            $Photos->photo = $myimg;            
            $Photos->save();                 
        }    
    } 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire