/** * Store a newly created resource in storage. * * @return Response */ public function store() { $track = Track::all(); $track = new Track(); $artist = Artist::all(); $artist = new Artist(); $id_artist = Input::get('id_artist'); $track_name = Input::get('name'); $track->id_artist = $id_artist; $track->name = $track_name; $archivo = array('file' => Input::file('file')); //$extension = Input::file('file')->getClientOriginalExtension(); $file_name = Input::file('file')->getClientOriginalName(); // $new_name = $this->replace_white_spaces($file_name); //ejecuta el metodo para caracteres especiales $dir_file = "/home/jona/Proyecto_Beto/CyberRockola/CyberRockola/uploads/rockola_music/"; //dirección fisica de las canciones Input::file('file')->move($dir_file, $new_name); //mueve con el nombre nuevo $track->dir_track = $dir_file . $new_name; //dirección exacta con el nombre de la cancion y extension $track->save(); return redirect('tracks'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $track = Track::all(); $track = new Track(); $artist = Artist::all(); $artist = new Artist(); $id_artist = Input::get('id_artist'); $track_name = Input::get('name'); $track->id_artist = $id_artist; $track->name = $track_name; $archivo = array('file' => Input::file('file')); $extension = Input::file('file')->getClientOriginalExtension(); $file_name = Input::file('file')->getClientOriginalName(); $new_name = $this->replace_white_spaces($file_name); $dir_file = "uploads/rockola_music/"; Input::file('file')->move($dir_file, $new_name); $track->dir_track = $dir_file . $new_name; $track->save(); return redirect('tracks'); }