久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 CakePHP 中上傳文件的最佳實(shí)踐

Best practice to upload files in CakePHP(在 CakePHP 中上傳文件的最佳實(shí)踐)
本文介紹了在 CakePHP 中上傳文件的最佳實(shí)踐的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

誰能建議我在 CakePHP 中編寫用于上傳文件的代碼的最佳方法?

Can any one suggest me the best way to write code for uploading a file in CakePHP?

  • 我需要上傳一個文件并將其名稱保存在表格中.
  • 如果記錄保存失敗,則不應(yīng)上傳文件.
  • 如果上傳失敗,則應(yīng)回滾記錄.
  • 代碼應(yīng)該是可重用的
  • 我需要在afterSave回調(diào)中上傳文件
  • I need to upload a file and save its name in table.
  • If the record saving fails it should not upload the file.
  • If the uploading fails then the record should be rollbacked.
  • The code should be reusable
  • I need to upload the file in afterSave callback

推薦答案

Edit (2015): 請參閱 Awesome CakePHP 當(dāng)前文件插件列表(2.x 分支 這里)

Edit (2015): Please see the Awesome CakePHP list for current file plugins (2.x branch here)

編輯(2013 年):這個答案現(xiàn)在有點(diǎn)過時了,所以我只留下所有提到的上傳插件的列表:

Edit (2013): This answer is now a bit dated, so I will just leave a list of all mentioned upload plugins:

  • josegonzalez/upload
  • milesj/Uploader
  • szajbus/uploadpack
  • webtechnick/CakePHP-FileUpload-Plugin (2.0-分支)
  • bmcclure/CakePHP-Media-Plugin (2.0-branch)
  • davidpersson/media(僅限 1.3.x)
  • jrbasso/MeioUpload(已棄用)
  • josegonzalez/upload
  • milesj/Uploader
  • szajbus/uploadpack
  • webtechnick/CakePHP-FileUpload-Plugin (2.0-branch)
  • bmcclure/CakePHP-Media-Plugin (2.0-branch)
  • davidpersson/media (1.3.x-only)
  • jrbasso/MeioUpload (deprecated)

原始答案(來自 2010 年):

Original answer (from 2010):

您可以考慮使用在上一屆 CakeFest 上討論過的媒體插件.它相當(dāng)全面,包含諸如創(chuàng)建文件變體(即圖像或視頻的縮略圖)、輸出不同類型文件的助手以及幫助更快創(chuàng)建多文件上傳表單的元素等功能;并且從一開始就非常關(guān)注安全性,因?yàn)槲铱梢詮?幻燈片中收集到.我在生產(chǎn)中使用它并發(fā)現(xiàn)它運(yùn)行良好,而且它似乎處于更多積極開發(fā) 比我見過的其他選項(xiàng)是否有任何意義(例如 MeioUpload 行為、上傳插件、FileUpload 插件 以及有關(guān)該主題的各種 Bakery/博客文章).

You might consider using the Media plugin that was talked about at the last CakeFest. It is fairly comprehensive, containing features such as creating file variations (ie. thumbnails of images or video), helpers for outputting different types of files, and elements to help create multiple-file upload forms more quickly; and also had a strong focus on security from the outset as I can gather from the slides. I use it in production and find it works well, plus it seems to be under more active development than other options I have seen if that's anything to go by (eg. MeioUpload behavior, Uploader plugin, FileUpload plugin and various Bakery/blog posts on the topic).

這篇關(guān)于在 CakePHP 中上傳文件的最佳實(shí)踐的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應(yīng)用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內(nèi)存大小為 134217728 字節(jié)已用盡(嘗試分配 87 字節(jié)))
主站蜘蛛池模板: 精品美女视频在线观看免费软件 | 狠狠干2020 | 在线观看日韩精品视频 | 成人在线中文字幕 | 亚洲日本视频 | 天天搞夜夜操 | 欧美日韩在线一区二区三区 | 中文字幕国产 | 欧美成人精品在线 | 在线观看av网站永久 | 黄a大片| 黑人中文字幕一区二区三区 | 久久精品男人的天堂 | 日韩一区二区三区在线观看 | av大片 | 免费超碰 | 国产又爽又黄的视频 | 精品一区二区三区在线观看国产 | 欧美视频三区 | 黑人精品| 亚洲国产成人久久综合一区,久久久国产99 | 国产午夜精品一区二区三区嫩草 | 亚洲一区 中文字幕 | 日韩精品久久久久 | 日韩精品久久久久 | 天天草av | 91久久久精品国产一区二区蜜臀 | 99精品国产在热久久 | 午夜精品一区二区三区在线播放 | 欧美精品一区二区三区在线 | 在线观看视频中文字幕 | 午夜影院普通用户体验区 | 国产精品资源在线 | 一级毛片中国 | 激情网站在线观看 | 殴美成人在线视频 | 97caoporn国产免费人人 | 日韩欧美一区二区三区免费观看 | 成人免费在线视频 | 精品欧美一区二区三区久久久 | 国产精品美女www爽爽爽 |