Beispiel #1
0
function upload_file($archivo, $dir, $id)
{
    //separamos nombre archivo extension
    $file = explode('.', $archivo->getClientOriginalName());
    if (isset($file[1])) {
        //eliminamos acentos (si es que hay)
        $nombre = eliminaAcentos($file[0]);
        $guardado = Storage::put($dir . '/' . $nombre . "___" . $id . "." . $file[1], file_get_contents($archivo->getRealPath()));
    } else {
        //eliminamos acentos (si es que hay)
        $nombre = eliminaAcentos($file[0]);
        $guardado = Storage::put($dir . '/' . $nombre . "___" . $id, file_get_contents($archivo->getRealPath()));
    }
    if ($guardado) {
        return 0;
    } else {
        return 1;
    }
}
Beispiel #2
0
function upload_file($archivo, $dir, $id)
{
    //separamos nombre archivo extension
    $file = explode('.', $archivo->getClientOriginalName());
    if (isset($file[1])) {
        //eliminamos acentos (si es que hay)
        $nombre = eliminaAcentos($file[0]);
        //ACTUALIZACIÓN 05-11-2016: Cada uno de los archivos se guardará en una carpeta con su id
        $guardado = Storage::put($dir . "/" . $id . "/" . $nombre . "." . $file[1], file_get_contents($archivo->getRealPath()));
    } else {
        //eliminamos acentos (si es que hay)
        $nombre = eliminaAcentos($file[0]);
        $guardado = Storage::put($dir . "/" . $id . "/" . $nombre, file_get_contents($archivo->getRealPath()));
    }
    if ($guardado) {
        return 0;
    } else {
        return 1;
    }
}