dongqiu3254 2016-11-20 13:18
浏览 269

使用html2canvas将屏幕截图保存到web文件夹

I have a website, where user can take screenshot of that website and that screenshot should save automaticly to folder "posters" inside my "www" folder. But when I try to make an screenshot, it is saved directly to "www" folder and not to the "posters" folder. I tried to change atributes of the "posters" folder to 777 but It did not helped. And also, that "posters" folder gives this error: Forbidden You don't have permission to access /posters/ on this server. when I try to visit it via browser. I dont know what is wrong.

Here is my save.php code:

<?php
//Get the base-64 string from data
$filteredData = substr($_POST['img_val'], strpos($_POST['img_val'], ",") + 1);

//Decode the string
$unencodedData = base64_decode($filteredData);

//Save the image
file_put_contents('img_' . date("U") . '.png', $unencodedData);

move_uploaded_file('img.png', './posters/$newname');

?>
<h2>Save the image and show to user</h2>
<table>
    <tr>
        <td>
            <a href="img.png" target="blank">
                Click Here to See The Image Saved to Server</a>
        </td>
        <td align="right">
            <a href="index.php">
                Click Here to Go Back</a>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <br />
            <br />
            <span>
                Here is Client-sided image:
            </span>
            <br />
<?php
//Show the image
echo '<img src="' . $_POST['img_val'] . '" />';
?>
        </td>
    </tr>
</table>
<style type="text/css">
body, a, span {
    font-family: Tahoma; font-size: 10pt; font-weight: bold;
}
</style>

Is it possible to make something like this? file_put_contents(.PathToFolder/'img_' . date("U") . '.png', $unencodedData);

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?