Landon Call Landon Call - 3 years ago 146
PHP Question

How to check size of a file in PHP

I am trying to check the size of my file using echo $_FILES['photo']['size'] but nothing is being returned.


<form method="POST" action="sendToDatabase.php">
<label>Album Artwork</label>
<input type="file" name="art" />
File must be saved as a .jpg file.<br />Please crop to 150px wide X 200px tall before uploading.

<input type="submit" name="submit" value="Submit Album" class="submitBtn" />


<?php echo $_FILES['art']['size']; ?>

Answer Source

you need to add enctype="multipart/form-data" into form tag


<form method="POST" action="sendToDatabase.php" enctype="multipart/form-data" >
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download