开发者

Implement drag-and-drop using AJAX in CakePHP

I wish to create a drag and drop feature for adding profile picture using CakePHP. Are there any samples which I can follow or a step by step guide?

I sourced many samples online but none of them cater for CakePHP.

I basically need a simple drag n drop for users to drag their profile image and the URL of开发者_运维问答 the image is reflected in the database. The user will be able to edit another profile image. What approach should I use for this?


what you want to do is mostly about front-end, the back-end is generic server handling (in this case, PHP upload handling) and has little to do with Cake. That's why you don't see a specific cake tutorial for this. So, look up jquery drag drop and ajax upload. You'll also need to understand Cake rather well (well enough to adapt those online sample code to your Cake app).


I recommend you to use jQuery UI's draggable and droppable interactions.

Integrating them in CakePHP is quite easy, just follow the manual instructions to include Javascript files in a CakePHP application.

Finally, updating the database to reflect the URL of the image can be easily done with jQuery as well, using the AJAX related methods (e.g. post).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜