•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 swap two variables without using 3rd temp variable.

692


Write a program using while loop in php?

734


What is difference between include,require,include_once and require_once()?

728


Does php need html?

720


Explain me what is the use of header() function in php?

792


Can you use php and javascript together?

756


Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?

932


What does csrf token mean?

671


What is php7?

811


What is the best way to test the strpos() return value in php?

742


Hi this is amul jani here, i complied my graduation in B.com stream.. but as career i looking for PHP language.. to get shape my career. so is that possible to enter in IT world.. for me how much scope of develop my career in this field.. amul jani

1769


How many records can be stored in mysql table?

758


How do you end php?

720


How do you connet mysql database with php?

776


What is difference between isset and empty in php?

733