Created
September 12, 2024 17:01
-
-
Save ggMartinez/01dbb594c48289b875d63fc10f0844ac to your computer and use it in GitHub Desktop.
Subir imagen - Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Asumiendo que el formulario envia por post una imagen, en un input llamado "imagen" | |
$file = $request->file('imagen'); | |
$originalName = $file->getClientOriginalName(); | |
$fileExtension = $file->getClientOriginalExtension(); | |
$fileName = $originalName "." . $fileExtension; | |
$destinationPath = 'imagenes'; | |
$file->move($destinationPath,$fileName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment