Source for file flexupload_example.php

Documentation is available at flexupload_example.php

  1. <?php
  2. /**
  3. * flexupload_example.php
  4. *
  5. * (C) 2007 SPLINELAB http://www.splinelab.com/flexupload/
  6. *
  7. * example how to use the FlexUpload class
  8. *
  9. *
  10. * Notes for migration from JavaUpload:
  11. *
  12. * This example is exactly the same like the one for the JavaUpload Applet.
  13. * As you can see migration from JavaUpload to FlexUpload is really simple.
  14. * Just change the class name to "FlexUpload" and you are done.
  15. *
  16. * FlexUpload uses a different approach to handle locale. Translations are
  17. * now stored in external xml files and not in property lists compiled into
  18. * the application. This is a great advantage because it's much more easier
  19. * to maintain the language files.
  20. * To specify the locale you now have to set the name of the language file
  21. * including the path to it!
  22. *
  23. * e.g.:
  24. * in JavaUpload you wrote
  25. * $jup = new JavaUpload();
  26. * $jup->setLocale("de_DE");
  27. *
  28. * in FlexUpload you write
  29. * $fup = new FlexUpload();
  30. * $fup->setLocale('locale/de.xml');
  31. *
  32. *
  33. * @version 1.0
  34. * @author Mirko Schaal <ms@splinelab.com>
  35. * @package FlexUpload
  36. * @subpackage example
  37. */
  38.  
  39. /**
  40. * including the FlexUpload class
  41. */
  42. require_once("./class.flexupload.inc.php");
  43.  
  44. ?>
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  46. <html>
  47. <head>
  48. <title>FlexUpload example</title>
  49. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  50. </head>
  51. <body link="#FF6600" vlink="#FF6600" alink="#FF6600" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  52. <center>
  53. <h3><hr width="100%"><font face="Arial, Helvetica, sans-serif">Example for FlexUpload in english</font><hr width="100%"></h3>
  54. <p>
  55. <?php
  56. // should work in most cases to generate the url to the upload file
  57. // if it don't work, set a hard coded string e.g.
  58. // $url = 'http://localhost/upload_example.php';
  59.  
  60. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/upload_example.php';
  61.  
  62. $fup = new FlexUpload($url.'?myGETVariable='.rawurlencode('you can even pass variables via GET e.g. a SESSION_ID to authenticate the user'));
  63. $fup->setMaxFileSize(5*1024*1024);
  64. $fup->printHTML(true, 'flexupload1');
  65.  
  66. ?>
  67. </p>
  68. <h3><hr width="100%"><font face="Arial, Helvetica, sans-serif">Beispiel für FlexUpload in Deutsch</font><hr width="100%"></h3>
  69. <p>
  70.  
  71. <?php
  72.  
  73. $fup = new FlexUpload($url);
  74. $fup->setMaxFileSize(5*1024*1024);
  75. $fup->setLocale('locale/de.xml');
  76. $fup->printHTML(true, 'flexupload2', false);
  77.  
  78.  
  79. ?>
  80.  
  81. <hr width="100%"><font size=-2 face="Arial, Helvetica, sans-serif"><a href="http://www.splinelab.com/flexupload/">(C) 2007 SPLINELAB</a></font>
  82. </center>
  83. </body>
  84. </html>

Documentation generated on Sun, 17 Jun 2007 11:38:02 +0200 by phpDocumentor 1.3.0RC3