php 图片上传器需要简单
我需要尽快完成这件事。在 php 中进行图像上传的简单方法是什么...我有一个脚本 atm 但如果出现同名图像,它会覆盖它。
基本上我只是希望能够使用表单字段文件来选择图像并上传,也许可以以某种方式重命名它。然后将该位置放入数据库以便在需要时检索。
关于如何做到这一点有什么建议或想法吗?没有太多时间来完成这件事。
I need to get this done very quickly. What's an easy way to do image uploading in php...I have a script atm but if an image with the same name comes it'll overwrite it.
Basically I just want to be able to use the form field file to select an image and upload and maybe rename it somehow. Then put the location into a database to retrieve when needed.
Any tips or ideas on how to do this? Don't have a lot of time to get this done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://www.google .co.za/search?sourceid=chrome&ie=UTF-8&q=php+image+upload
http://www.plupload.com/ - 也是一个很好的方法。做某事
在我看来,您正在寻找简单的出路。请记住,我们并不是为您提供代码解决方案,而只是作为顾问小组来帮助您克服当前(已尝试使其工作)代码中的一些障碍。如果你读一点,它真的很容易,这就是所有内容的文档的原因,特别是 PHP 和文件上传。
:)
http://www.google.co.za/search?sourceid=chrome&ie=UTF-8&q=php+image+upload
http://www.plupload.com/ - is also a good way to do this. Doing something
Sounds to me like you are looking for the easy way out. Please remember that we are not here to give you your code solution, but merely as an advisory panel to help you get over some obstacles in your current (already tried to make it work) code. If you read up a bit its real easy, thats the reason for documentation on everything, especially PHP and file uploading.
:)
现在在我看来,您的脚本也存在安全问题。
在保存之前,将唯一的哈希值附加到文件名的末尾。这样就没有人可以覆盖您的文件。
Seems to me right now, your script has a security issue as well.
Append a unique hash to the end of the filename before you save it. That way no one can overwrite your files.
您可以将
uniqid()
附加到文件名吗?显然仍然需要变得更加安全。
Can you just append
uniqid()
to the filename..?Obviously still needs to be made more secure.