Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...



•How to upload files using PHP?

Answers were Sorted based on User's Feedback



•How to upload files using PHP?..

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

•How to upload files using PHP?..

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

•How to upload files using PHP?..

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

Post New Answer



More PHP Interview Questions

hi, i have knowledge about PHP/MYSQL,i am fresher of M.Sc-IT 2009 pass out,any recruitment in PHP please let me know.my email id:nathiyasms@gmail.com

0 Answers  


What is 'float' property in css?

0 Answers  


How do I install php and apache on windows 10?

0 Answers  


How about integrating an iKode Newsletter Server at my independent Wordpress blog site? I just wanna visitort can subscribe my blog when they like it and I can send some interested articles or events to them regularly to establish good relationship.

1 Answers   iKode,


How to read a file in php?

0 Answers  






What is associative array in php?

0 Answers  


What is a php 5?

0 Answers  


what will do ceil() and floor() in PHP?

5 Answers  


How do you use an array in excel?

0 Answers  


Is php a dying language?

0 Answers  


how php works with oracle?

1 Answers  


What is the difference between laravel and php?

0 Answers  






Categories