问题
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 :
- have a client-side variable
albumId
, default empty - bind to the
BeforeUpload
uploader event - in
BeforeUpload
handler, see ifAlbumId
is set. If not, perform a synchronous ajax call to create an album and retrieve its albumId, you will put in variablealbumId
- 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