我们希望创建一个用户可以在其中发布东西的网站,我们已经建立了聊天系统,但也希望允许用户发布文档和图像。有谁知道这是怎么做到的吗?
我在这里搜索是否有人已经遇到了这个问题,但是我没有看到任何人。
<script src="http://localhost/chat.html"></script>
<div class="chatcontainer">
<div class="chatheader">
<h3>Welcome<?php echo ucwords($user); ?></h3>
</div>
<div class="chatmassages"></div>
<div class="chatbottom">
<form action="#" onsubmit="return false;" id="chatform">
<input type="hidden" id="name" value="<?php echo $user; ?>" />
<input type="text" name="text" id="text" value="" placeholder="type your chat massage" />
<input type="submit" name="submit" value="post" />
</form>
</div>
</div>
我认为我需要再添加一个按钮,但是代码看起来如何?
答案 0 :(得分:0)
您需要添加:
<input type=“file” accept=“.jpg,.png etc”>
检查此链接以获取更多信息https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file。