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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器