- Go to the folder of web server and search for 'php.ini' file in 'bin\php' folder...
- Open 'php.ini' file with administrator permissions...
- Search for 'file_uploads' in the file and set it as 'on'...
- Search for 'upload_max_filesize' in the file and set it as required...
- Save the file and close it...
- Write code for html form for uploading file (say index.html)...
<html>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>
- Write code for php to upload file (say upload.php)
<?php
$filename = "Image00.jpg";
move_uploaded_file($_FILES['file']['tmp_name'], $filename);
echo "File uploaded successfully";
?>
- Now open 'index.html' file in your web server...