Last active
November 28, 2018 21:06
-
-
Save thedineshj/619fbbe86f969ea9997136923dc09805 to your computer and use it in GitHub Desktop.
PHP - How to count number of uploaded files ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_POST['submit'])){ | |
function countUploadedFiles($name){ | |
/* | |
if a user submits the form | |
with out selecting any files | |
*/ | |
if($_FILES[$name]['size'][0]==0){ | |
echo "0 FILES UPLOADED"; | |
return; | |
} | |
$filesCount=count($_FILES[$name]['tmp_name']); | |
echo "{$filesCount} FILES UPLOADED"; | |
return; | |
} | |
countUploadedFiles("pictures"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment