Magento Expert Forum - Improve your Magento experience

Results 1 to 2 of 2

Easy way to get file extension in PHP

  1. #1
    Moderator speed2x's Avatar
    Join Date
    Mar 2013
    Location
    Hollywood, Florida, United States
    Posts
    88
    Thanks
    8
    Thanked 7 Times in 6 Posts

    Post Easy way to get file extension in PHP

    I use this code many times in my projects and now I share you this useful code. Sometimes in coding a very simple task can take you a lot of time to make a perfect solution. To get a file extension sometimes take me 30 mins to do the perfect code what work well in all of situation. But now it should take one minute with this code:

    PHP Code:
    function get_file_extension($file_name) {
        return 
    substr(strrchr($file_name,'.'),1);

    This simple method of file extension retrieval should be reused throughout your code.

    View more threads in the same category:


  2. #2
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Get The File Extension In PHP. Getting a record augmentations from a PHP string is a critical undertaking on approving a document for a transfer. For instance in the event that you have a document uploader which you just need to use for picture transfers then you have to approve the record augmentation is of a picture expansion.

Similar Threads

  1. Replies: 1
    Last Post: 14-03-2019, 07:22 AM
  2. Easy and Affordable Magento Hosting
    By sgdev in forum Magento Hosting, VPS, Server by Siteground
    Replies: 15
    Last Post: 15-09-2018, 08:28 AM
  3. SEO in Ten Easy Steps
    By ccvv in forum Magento SEO technique
    Replies: 16
    Last Post: 29-12-2016, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •