I hope you can support me with uploading an image to laravel 5.6
attached.
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'archivosimg' => [
'driver' => 'local',
'root' => storage_path('archivosimg'),
],
'archivos' => [
'driver' => 'local',
'root' => storage_path('archivos'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
if(quien=="formNewTicket"){ var url="newTicket"; var divresul="notificacion";
var formData = new FormData($("#"+quien+"")[0]);
$.ajax({
type:'POST',
url:url,
/*datatype:'json',*/
data : formData,
cache:false,
contentType:false,
processData:false,
beforeSend: function(){
/*$("#"+divresul+"").html($("#cargador_empresa").html());*/
},
//una vez finalizado correctamente
success: function(data){
/*$("#"+divresul+"").html(data);
location.reload(true);*/
console.log(data);
},
//si ha ocurrido un error
error: function(data){
alert("ha ocurrido un error") ;
console.log(data);
}
});
I do not understand why Driver sends me [] is not supported
public function newTicket(Request $request){
$data = Request()->all();
$usuarioactual=\Auth::user();
$sede = Seat::find($usuarioactual->D1ID);
$pabellon = Pavilion::find($data["pabellon"]);
$piso = Floor::find($data["piso"]);
$ambiente = Ambient::find($data["ambiente"]);
$ticket = new Ticket;
$ticket->C1id=$data["criti"];
$ticket->P1ID=$data["prov"];
$ticket->idUser=$data["id"];
$ticket->K1UBICACION= $sede->D1DESCRIPCION.''.$pabellon->P3DESCRIPCION.''.$piso->P2DESCRIPCION.''.$ambiente->B1DESCRIPCION;
$ticket->A1ID=$data["origen"];
$ticket->K1MOTIVO=$data["motivo"];
$ticket->K1FECHA=date('d/m/Y H:i:s');
$ticket->E1ID=1;
$ticket->D1ID=$sede->D1ID;
$ticket->P2ID=$data["piso"];
$ticket->P3ID=$data["pabellon"];
$ticket->B1ID=$data["ambiente"];
/ Read from here and debugee the error I get when adding the line where $ r1 = Storage :: disk ..... .... ... /
$archivosimg = $request->file('archivosimg');
if(file_exists($archivosimg)){
$nombre_original = $archivosimg->getClientOriginalName();
$extension = $archivosimg->getClientOriginalExtension();
$new_name=$sede->D1DESCRIPCION.''.$pabellon->P3DESCRIPCION.''.$piso->P2DESCRIPCION.''.$ambiente->B1DESCRIPCION.".".$extension;
$input = array('image'=> $archivosimg);
$ruler = array('image'=> 'required|image|mimes:jpeg,jpg,bmp,png,gif|max:3000');
$validacion = Validator::make($input,$ruler);
if ($validacion->fails()) {
return "imagen rechazado";
}else{
$r1=Storage::disk('archivosimg')->put($nombre_original, \File::get($archivosimg) );
return $archivosimg.':::::::::::::'.$nombre_original;
}
}else{
return "no se subio imagne";
}
}