How to get the information about the uploaded file in the receiving Script?

Posted by Prem Tiwari | Updated on

How to get the information about the uploaded file in the receiving Script?

This receiving PHP script can get the information of the uploaded file using the predefined array called $_FILES. PHP arranges this information in $_FILES as a two-dimensional array. We can retrieve it as follows.

  • $_FILES[$fieldName][‘name’] – It represents the file name on the browser system.
  • $_FILES[$fieldName][‘type’] – It indicates the file type determined by the browser.
  • $_FILES[$fieldName][‘size’] – It represents the size of the file in bytes.
  • $_FILES[$fieldName][‘tmp_name’] – It gives the temporary filename with which the uploaded file got stored on the server.
  • $_FILES[$fieldName][‘error’] – It returns the error code associated with this file upload.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers