I've downloaded files from my svn that are now stored in a folder on my local disk. The folder name is cs_DATA and within the folder I have another folder which contains all the files (unncessary but I just saved it that way). These files are the code files I have stored in subversion. Most of these files are php files. How can I read in documents (that aren't "txt") which are located on my local disk and open them on a website that uses php. Currently when I load them in, it echoes out as an empty string. This is what I have
index.php
<script>
$(function() {
$('#getData').click(function(event) {
event.preventDefault();
$.ajax({
type: "GET",
url: "endPoint.php",
data : { field2_name : $('#userInput2').val() },
beforeSend: function(){
}
, complete: function(){
}
, success: function(html){
//this will add the new comment to the `comment_part` div
$("#displayParse").html(html);
//$('[name=field1_name]').val('');
}
});
});
});
</script>
<form id="comment_form" action="endPoint.php" method="GET">
Enter the file you would like to view:
<input type="text" class="text_cmt" name="field2_name" id="userInput2"/>
<input type="submit" name="submit" value="submit" id = "getData"/>
<input type='hidden' name='parent_id' id='parent_id' value='0'/>
</form>
<div id="displayParse">
</div>
endPoint.php
<?php
$filePath = $_GET["field2_name"];
$url = "cs_DATA/files/" . $filePath;
$contents = file_get_contents($url);
echo '<div class="comment">', htmlspecialchars($contents),'</div>';
?>
Nothing is printing out so I can only assume that how I'm accessing my local files is incorrect. I've written my code on phpstorm and am running it on a localhost. The files I need to have access are all stored on my computer. Not sure if that affects it in any way.