Friday 18 May 2012

How to upload large files onto the web server using PHP


  1. Go to the folder of web server and search for 'php.ini' file in 'bin\php' folder...
  2. Open 'php.ini' file with administrator permissions...
  3. Search for 'file_uploads' in the file and set it as 'on'...
  4. Search for 'upload_max_filesize' in the file and set it as required...
  5. Save the file and close it...
  6. 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>
  1. 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";
?>
  1. Now open 'index.html' file in your web server...

No comments:

Post a Comment