Google News
logo
PHP - Interview Questions
How to upload files in PHP?
Firstly, PHP should allow file uploads; this can be done by making the directive file_uploads = On
 
You can then add the action method as 'post' with the encoding type as 'multipart/form-data'.
 
<form action="sample_upload.php"method="post"enctype="multipart/form-data">​


The myupload.php file contains code specific to the fule type to be uploaded, for example, image, document, etc., and details like target path, size, and other parameters.
 
You can then write the HTML code to upload the file you want by specifying the input type as 'file.'
Advertisement