file uploading code in php
How to HTML form will work
How to HTML form will work
<form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="fileupload" id="file" /> <input type="submit" name="submit" value="Upload file" /> </form>PHP file code
<?php if ($_FILES["fileupload"]["error"] > 0) { echo "Error code when upload: " . $_FILES["fileupload"]["error"] . "<br />"; } else { echo "Upload file name : " . $_FILES["fileupload"]["name"] . "<br />"; echo "Type of the file: " . $_FILES["fileupload"]["type"] . "<br />"; echo "Size of the file in KB: " . ($_FILES["fileupload"]["size"] / 1024) . "<br />"; echo "Stored in temporary folder : " . $_FILES["fileupload"]["tmp_name"]; move_uploaded_file($_FILES["fileupload"]["tmp_name"],"uploads/".$_FILES["file"]["name"]); } ?>