$originalFileName = $file->getName(); $extension = pathinfo($originalFileName, PATHINFO_EXTENSION); // If it's a PDF, convert fileName to .xlsx for DB check if (strtolower($extension) === 'pdf') { $fileName = pathinfo($originalFileName, PATHINFO_FILENAME) . '.xlsx'; } else { $fileName = $originalFileName; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter