•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 get no of arguments passed to a PHP Function?

701


What is meant by urlencode and urldecode?

844


What are the encryption functions in php?

804


If the variable $var1 is set to 10 and the $var2 is set to the character var1, what's the value of $$var2?

744


Which is the best php framework for a beginner?

728


What is the main difference between php 4 and php 5?

753


List types of array are available in php?

769


Where are cookies stored php?

681


How to pad an array with the same value multiple times?

678


How to read the entire file into a single string?

796


Explain the ternary conditional operator in php?

823


What is the difference between myisam and innodb?

746


What is the use of rand() in php?

801


What is member function?

800


Which functions are used to remove whitespaces from the string?

925