接受用户上传最佳做法! [英] accepting user uploads best practices!

查看:175
本文介绍了接受用户上传最佳做法!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在php中使用zend框架添加多页面表单,用户可以在其中列出项目到我的站点。在第一页上,他们输入有关该项目的详细信息(然后存储在会话中),第二页他们可以上传图像,然后第三页他们可以确认列表。如果他们确认,则添加列表。

Im trying to add a multi page form, in php with zend framework, where users can list an item to my site. On the first page they enter details about the item(which is then stored in session), page two they can upload images, and then page three they can confirm the listing. If they confirm then the listing is added.

在允许用户上传图片方面,实现此目的的最佳方法是什么?我将使用SWFUpload或uploadify,但是我应该将图像直接添加到数据库中,如果是这样,在哪个列表ID下?在用户点击确认之前,我不会创建列表ID。那么最佳做法是什么?我应该将它们存储在以会话命名的临时文件夹中吗?存储在数据库中的临时名称如地址+会话或什么?

What is the best way to achieve this with regards to allowing users to upload images? I am going to either use SWFUpload or uploadify, but should i add the images straight to the database and if so under which listing id? I dont create the listing id until the user clicks confirm. So whats the best practises? should i store them in a temp folder named after session? store in database under temp name like address + session or what?

编辑:嘿抱歉也许我没有表达自己非常清楚。我不是在寻找上传文件的方法。在我知道用户是否确实要确认列表之前,我要问的是如何最好地存储它们。我应该将它们存储在临时文件夹中,然后在用户确认列表时处理它们,然后编写一个删除一小时前创建的文件夹的自动脚本。或者我应该将它们存储在临时表中的数据库中的某种由会话和列表属性组成的密钥下?基本上我问的是,在你确认并创建它之前,ebay对你上传的图片做了什么。

edit: Hey sorry maybe I have not expressed myself very clearly. I am not looking for a way to upload files. What I am asking is how best to store them before I know whether the user is actually going to confirm the listing. Should i store them in a temp folder and then process them when the user confirms listing and then write an automatic script that deletes folder created over an hour ago. Or should i store them in the database in a temp table under some kind of key made up of session and a listing attribute? Basically I am asking what does ebay do to the images that you upload when adding a listing but before you have confirmed and created it.

非常感谢你的帮助!

推荐答案

由于您提到了Zend Framework,我将包含文档的链接以及摘录:

Since you mentioned Zend Framework, I'm including links to the documentation along with an excerpt:


Zend_File_Transfer为文件上传和
下载提供广泛的
支持。它带有内置的
文件验证器以及
功能,可以使用
过滤器更改文件。协议适配器允许
Zend_File_Transfer为HTTP,
FTP,WEBDAV等传输协议公开相同的
API。

Zend_File_Transfer provides extensive support for file uploads and downloads. It comes with built-in validators for files plus functionality to change files with filters. Protocol adapters allow Zend_File_Transfer to expose the same API for transport protocols like HTTP, FTP, WEBDAV and more.

了解详情: http://framework.zend.com /manual/en/zend.file.html


Zend_File_Transfer附带
几个与文件相关的验证器
可用于增加安全性,
可用于防止可能的攻击。<​​/ p>

Zend_File_Transfer is delivered with several file-related validators which can be used to increase security and prevent possible attacks.

阅读更多: http://framework.zend.com/manual/en/zend.file.transfer .validators.html

例如: http://ahsangill.wordpress.com/2009/02/17/zend-framework-file-upload-u sing-zend_form_element_file /

这篇关于接受用户上传最佳做法!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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