Uploadify 3.2 Background Dynamic transfer parameters

Source: Internet
Author: User

Recently in a small upload function, you need to pass some dynamic parameters, online some parameters may be because the version is not successful. Carefully read the official website of some instructions, done.

3.2 passed the parameter is ' FormData ': {' somekey ': ' somevalue '} This property, but it can not pass dynamic parameters, dynamic parameter needs to use the method of settings, official online also explained. Examples are as follows:

[JavaScript]View PlainCopy 
  1. JQuery (document). Ready (function () {
  2. var ctrlid = getquerystring ("Ctrlptid");
  3. JQuery ("#file_upload"). Uploadify ({
  4. ' buttonimage ': '/uploadify/browse-btn.png ',
  5. ' auto ': false,
  6. ' successtimeout ': 99999,
  7. ' swf ': '/uploadify/uploadify.swf ',
  8. ' Queueid ': ' uploadfilequeue ',
  9. ' uploader ': '/uploadify/uploadhandler.ashx ',
  10. ' filesizelimit ': ' 0 ',
  11. ' filetypeexts ': ' *.gif; *.jpeg; *.jpg; *.png ',
  12. ' Multi ': false,
  13. ' Queuesizelimit ': 5,
  14. ' progressdata ': ' speed ',
  15. ' overrideevents ': [' Ondialogclose '],
  16. //' FormData ': {' somekey ': ' somevalue ', ' CtrlId ': 2},//only static parameters can be passed here
  17. //' filetypeexts ': ' *.rar;*.zip;*.7z;*.jpg;*.jpge;*.gif;*.png ',
  18. ' onselecterror ': function (file, ErrorCode, errormsg) {
  19. switch (errorCode) {
  20. case-100:
  21. Alert ("The number of uploaded files has exceeded the system limit" + jQuery (' #file_upload '). Uploadify (' Settings ', ' queuesizelimit ') + " A file!  ");
  22. Break ;
  23. case-110:
  24. Alert ("file [" + File.name + "] size exceeds system limit" + jQuery (' #file_upload '). Uploadify (' Settings ', ' Filesizelimit ') + "Size!  ");
  25. Break ;
  26. case-120:
  27. Alert ("file [" + File.name + "] size is abnormal!  ");
  28. Break ;
  29. case-130:
  30. Alert ("file [" + File.name + "] type is incorrect!  ");
  31. Break ;
  32. }
  33. },
  34. ' onclearqueue ': function (queueitemcount) {
  35. Alert ("Cancel upload");
  36. return;
  37. },
  38. ' onqueuecomplete ': function (queuedata) {
  39. Alert ("File upload succeeded!")  ");
  40. return;
  41. },
  42. ' Onuploadstart ': function (file) {
  43. $ ("#file_upload"). Uploadify ("settings", "FormData", { ' ctrlid ': CtrlId});
  44. //In the Onuploadstart event, that is, before uploading, the parameters are written to the backstage.
  45. }
  46. });
  47. });

Background to obtain parameters, you can use the context. request.form["CtrlId"] to obtain.

Uploadify 3.2 Background Dynamic transfer parameters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.