How can i get the content of uploaded file in php?

php

Solution

$fileContent = file_get_contents($_FILES['upload_file']['tmp_name']);

Refer to the manual: `$_FILES` for an overview and this tutorial: Tizag PHP - File Upload for a walkthrough.

This PHP Manual section is a must-read as well: Handling File Uploads - moved from hakre's comment.

Problem

I can upload a file by using html file type and then I store that file information to mysql db. Here's my code=> ``` $upload = wp_upload_bits($_FILES["upload_file"]["name"], null, file_get_contents($_FILES["upload_file"]["tmp_name"])); $document_name = $_FILES['upload_file']['name']; $document_link = $upload['url']; //and DB Operations in here..(I store to db filename,date,filelink etc.) ``` My problem is, I can't read the file content to store it to db. (I will do search on the file content, so I must read content of file.) Briefly how can i read the content of a file like pdf, doc or etc. from url such as http://...../uploads/exampleFile.docx?

Original source