Reputation: 123
On the page "index.php", I have the following html:
<form class="centerd" method="post" action="upload.php" enctype="multipart/form-data">
<textarea id="html" type="text" name="html-text"></textarea>
<input type="submit" value="upload"/>
</form>
On the page "upload.php", I have the following PHP code:
<?php
file_put_contents("/files/test.html", htmlspecialchars($_POST['html-text']));
?>
<h1>From the textbox:</h1>
<? echo htmlspecialchars($_POST['html-text']); ?>
I want the text from the textbox to show up after the <h1>
tag, and I want /files/test.html
to be created (/files/
already exists), and the text from the textbox to be put into the test.html
file.
What actually happens, is whatever is in the textbox shows up after the <h1>
tag, but /files/test.html
is never created.
Upvotes: 0
Views: 1546
Reputation: 1
I'm sorry that I cannot comment on what Brannon said, I simply don't have reputation for it yet. But to the point:
There are two possibilities:
Upvotes: 0
Reputation: 1336
It looks like "/files/test.html"
is an absolute path. Have you tried "files/test.html"
?
Upvotes: 4