Plupload set album name before upload

寵の児 提交于 2019-12-11 07:19:03

问题


I just knew that upload.php file will run for each uploaded file. So when if there are 5 files, the upload.php will run 5 times right?

I need to insert a record into mysql 'album' table so that I can get the albumid to be inserted into the 'photos' table.

My idea is to run a script before the upload starts.

How is that possible with plupload? Or any different idea guys?

Or to the root question, is there any way to specify the album for the uploaded photos?

Thanks


回答1:


I guess you could :

  1. have a client-side variable albumId, default empty
  2. bind to the BeforeUpload uploader event
  3. in BeforeUpload handler, see if AlbumId is set. If not, perform a synchronous ajax call to create an album and retrieve its albumId, you will put in variable albumId
  4. still in BeforeUplad handler, add the albumId in the queryParameters : upldr.settings.url = upldr.settings.url + '&albumId=' + albumId

I guess it should work, without having to use any kind of locking mechanism on albumId.

Hope this will help.



来源:https://stackoverflow.com/questions/14786842/plupload-set-album-name-before-upload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!