•How to upload files using PHP?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / kapil dhiman
<?php
move_uploaded_file($_FILES['file']['tmp_name'],"images/".$_FILES['file']['name']);
?>
<form action="" method="post" enctype="multipart/form-data">
File<input type="file" name="file" /><input type="submit" name="sub" value="Upload" />
</form>
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / rashmi
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:
<?php
$data="any_file.Ext";
$ft=filetype($data);
header('content-type: application/$ft');
header('content-length:'filesize($data));
header('content-disposition:filename='.$data);
echo file_get_contents($data);
Is This Answer Correct ? | 4 Yes | 1 No |
Why do we use inheritance in php?
Which method do you follow to get a record from a million records? (Searching not from database, from an array in php)?
How to call javascript function in php on button click?
Do you know what's the difference between __sleep and __wakeup?
Is php still in demand?
what is mean php ? is it designingtool or language? how ill create website using by php?
How do I find out the number of parameters passed into function9?
how can attached a file to a mail and attached a resume to a mail and received in id
What are php data types?
Why do we use session?
What is final class and final method?
programm for factorial