我正在创建一个包含几个字段的表单,例如“标题”、“日期”、“文本区域”以及使用 PLupload 上传照片的选项。
但是上传表格并将照片附加到我的数据库中正确帖子的最佳方式是什么?
我目前的方法是,当点击保存按钮时:
function save() { // javascript function
// step 1. do an empty jquery post, so I get a (database) ID of my new post
// step 2. start PLupload upload, with as parameter the ID from step 1 (using multipart_params in PLupload)
// step 3. when PLupload is ready, update the form with the complete content (title, date, textarea.
}
但是这种方法对于简单的形式来说有点复杂。我正在寻找更简单的方法。我怎样才能做到这一点?