如何在PHP中创建页面以上传图片 [英] How to create a page in PHP to upload pictures

查看:57
本文介绍了如何在PHP中创建页面以上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi pple



hi pple

I have an question, i am creating a webpage for an assignment and one is that I have to create a page for the users to upload their pictures for other to see and take but I would like to know how do i go about doing that in php. can someone point me in the right direction. or at least give me a head start.





我的尝试:





What I have tried:

I have an question, i am creating a webpage for an assignment and one is that I have to create a page for the users to upload their pictures for other to see and take but I would like to know how do i go about doing that in php. can someone point me in the right direction. or at least give me a head start.

推荐答案

我希望它会有所帮助。





I hope it will help.


<form action="accept-file.php" method="post" enctype="multipart/form-data">
Your Photo: <input type="file" name="image" size="25" />
<input type="submit" name="submit" value="Submit" />
</form>
After you create this HTML form, you’ll now have to write a PHP script in order to process the PHP file upload. Below you’ll find PHP file upload script code for the same.
PHP Script:
//if they DID upload a file...
if(


_FILES ['image'] ['name'] )
{
//如果没有错误...
if(!
_FILES['image']['name']) { //if no errors... if(!


_FILES ['image'] ['error'])
{
//现在是修改未来文件名和验证文件的时间
_FILES['image']['error']) { //now is the time to modify the future file name and validate the file


这篇关于如何在PHP中创建页面以上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆