Mar 8, 2017
0
Level 2
Undefined offset when explode image
This question already has an answer here: PHP: “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” 19 answers i am trying to make a image upload on Laravel Rest Api. When i try to upload and save image in localhost it works fine, but when i try to do the same thing with the same code in my server i get a "Undefined offset: 2", here is my code
list($width, $height) = getimagesize($file); $extension = $file->getClientOriginalExtension(); $final_filename = $file->getFilename() . '.' . $extension; $name = explode('.',$final_filename)[0]; $extension = explode('.',$final_filename)[2]; $final= $name.'.'.$extension;
Please or to participate in this conversation.