Making my image uploading code DRY with PHP
I'm using PHP to upload a pdf. I now have to edit the code to upload up to 5 PDFs, each with a different input and name. I'd like to alter the code so it loops through 5 times once for each of the 5 inputs.

The input names are uploadedpdf1, uploadedpdf2, uploadedpdf3, uploaded4, & uploadedpdf5.

The current code is as follows.


    if($_FILES["uploadedpdf1"]["name"]!="") {

    $fileName = $_FILES["uploadedpdf1"]["name"]; // The file name
    $fileTmpLoc = $_FILES["uploadedpdf1"]["tmp_name"]; // File in the PHP tmp folder
    $fileType = $_FILES["uploadedpdf1"]["type"]; // The type of file it is
    $fileSize = $_FILES["uploadedpdf1"]["size"]; // File size in bytes
    $fileErrorMsg = $_FILES["uploadedpdf1"]["error"]; // 0 = false | 1 = true
    $kaboom = explode(".", $fileName); // Split file name into an array using the dot
    $fileExt = end($kaboom); // Now target the last array element to get the file extension

    }

How can I alter this to loop through 5 times with only the '1' at the end of'uploadedpdf altered? 
Making my image uploading code DRY with PHP
===

I'm using PHP to upload a pdf. I now have to edit the code to upload up to 5 PDFs, each with a different input and name. I'd like to alter the code so it loops through 5 times once for each of the 5 inputs.

The input names are uploadedpdf1, uploadedpdf2, uploadedpdf3, uploaded4, & uploadedpdf5.

The current code is as follows.


    if($_FILES["uploadedpdf1"]["name"]!="") {

    $fileName = $_FILES["uploadedpdf1"]["name"]; // The file name
    $fileTmpLoc = $_FILES["uploadedpdf1"]["tmp_name"]; // File in the PHP tmp folder
    $fileType = $_FILES["uploadedpdf1"]["type"]; // The type of file it is
    $fileSize = $_FILES["uploadedpdf1"]["size"]; // File size in bytes
    $fileErrorMsg = $_FILES["uploadedpdf1"]["error"]; // 0 = false | 1 = true
    $kaboom = explode(".", $fileName); // Split file name into an array using the dot
    $fileExt = end($kaboom); // Now target the last array element to get the file extension

    }

How can I alter this to loop through 5 times with only the '1' at the end of'uploadedpdf altered? 