how to read uploaded files from xampp
Posted
by user225269
on Stack Overflow
See other posts from Stack Overflow
or by user225269
Published on 2010-05-11T11:10:22Z
Indexed on
2010/05/11
11:14 UTC
Read the original article
Hit count: 195
I have this code for uploading files on the server:
<tr>
<td>
<form enctype="multipart/form-data" action="uploadaction.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
</td>
</tr>
<tr>
<td>
Select the image: <input name="uploadedfile" type="file" />
</td>
<tr>
<td>
<input type="submit" value="Upload File" />
</form>
</td>
</tr>
And here's the action form:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
What php function will I use? Can you give me an example on how to read the file back and display it in the browser? Please help, thanks.
© Stack Overflow or respective owner