How to upload files? Reviewed by Momizat on . NOTE :- First Check your enctype attribute of form control. Here return $_FILES['upoadfiles'] five feature of file. [upoadfiles] => Array ( [name] => Chrysanthe NOTE :- First Check your enctype attribute of form control. Here return $_FILES['upoadfiles'] five feature of file. [upoadfiles] => Array ( [name] => Chrysanthe Rating: 0

How to upload files?

NOTE :- First Check your enctype attribute of form control.
Here return $_FILES['upoadfiles'] five feature of file.
[upoadfiles] => Array
(
[name] => Chrysanthemum.jpg
[type] => image/jpeg
[tmp_name] => D:\wamp\tmp\php411F.tmp
[error] => 0
[size] => 425243
)

PHPCode (uploadfiles.php)

<?php
if(isset($_POST['submit'])){ 
 if(!empty($_FILES['upoadfiles']['name'])){
 move_uploaded_file($_FILES['upoadfiles']['tmp_name'],'uploadfolder/'.$_FILES['upoadfiles']['name']); 
 }
}
?>

HTML Code (uploadfiles.php)

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head><body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data">
<table width="100%" border="0">
<tr>
<td>Upload file</td>
<td><input type="file" name="upoadfiles" id="upoadfiles"></td>
</tr>

<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" id="submit" value="submit"></td>
</tr>
</table>
</form>
</body>
</html>

Comments (1)

Leave a Comment

© 2014 Powered By