•How to upload files using PHP?

Answer Posted / sei thu htun

Here is example code:
On HTML:
<form enctype="multipart/form-data" action="uploader.php"
method="POST">
<input name="uploadedfile" type="file" />
<input type="submit" value="Upload File" />
</form>

On PHP Script:

$target_path="YOUR_TARGET_PATH_FOR_STORE_UPLOAD_FILE_ON_SERVER";

if(@move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
$target_path)) {
echo "Success";
} else{
echo "Error";
}

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to select a database in php?

661


Is php 5.6 secure?

618


What is php and sql?

618


What are the methods to submit form in php?

620


Do csrf tokens expire?

580






What is mvc in php?

626


How to read one character from a file?

625


How can we determine whether a php variable is an instantiated object of a certain class?

619


Define object-oriented methodology?

658


How can we change the maximum size of the files to be uploaded?

605


In how many ways we can retrieve the data in the result set of mysql using php?

565


What is mysqli php?

608


What is the use of return in php?

563


Which php framework is best for security?

600


How to retrieve values out of an array?

590