Source for file flexupload_example.php

Documentation is available at flexupload_example.php

  1. <?php
  2. /**
  3. * flexupload_example.php
  4. *
  5. * example how to use the FlexUpload class
  6. *
  7. * Copyright (C) 2007 SPLINELAB, Mirko Schaal
  8. * http://www.splinelab.de/flexupload/
  9. *
  10. * All rights reserved
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the Free
  14. * Software Foundation; either version 2 of the License, or (at your option)
  15. * any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but WITHOUT
  18. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  19. * FITNESS FOR A PARTICULAR PURPOSE.
  20. * See the GNU General Public License for more details.
  21. *
  22. * The GNU General Public License can be found at
  23. * http://www.gnu.org/copyleft/gpl.html.
  24. * A copy is found in the textfile GPL and important notices to the license from
  25. * the author is found in the LICENSE file distributed with the program.
  26. *
  27. * This copyright notice MUST APPEAR in all copies of the program!
  28. *
  29. * ---------------------------------------------------------------------------
  30. * Notes for migration from JavaUpload:
  31. *
  32. * This example is exactly the same like the one for the JavaUpload Applet.
  33. * As you can see migration from JavaUpload to FlexUpload is really simple.
  34. * Just change the class name to "FlexUpload" and you are done.
  35. *
  36. * FlexUpload uses a different approach to handle locale. Translations are
  37. * now stored in external xml files and not in property lists compiled into
  38. * the application. This is a great advantage because it's much more easier
  39. * to maintain the language files.
  40. * To specify the locale you now have to set the name of the language file
  41. * including the path to it!
  42. *
  43. * e.g.:
  44. * in JavaUpload you wrote
  45. * $jup = new JavaUpload();
  46. * $jup->setLocale("de_DE");
  47. *
  48. * in FlexUpload you write
  49. * $fup = new FlexUpload();
  50. * $fup->setLocale('locale/de.xml');
  51. *
  52. *
  53. * @version 1.0
  54. * @author Mirko Schaal <ms@splinelab.com>
  55. * @package FlexUpload
  56. * @subpackage example
  57. */
  58.  
  59. /**
  60. * including the FlexUpload class
  61. */
  62. require_once("./class.flexupload.inc.php");
  63.  
  64. ?>
  65. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  66. <html>
  67. <head>
  68. <title>FlexUpload example</title>
  69. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  70. </head>
  71. <body link="#FF6600" vlink="#FF6600" alink="#FF6600" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  72. <center>
  73. <h3><hr width="100%"><font face="Arial, Helvetica, sans-serif">Example for FlexUpload in english</font><hr width="100%"></h3>
  74. <p>
  75. <?php
  76. // should work in most cases to generate the url to the upload file
  77. // if it don't work, set a hard coded string e.g.
  78. // $url = 'http://localhost/upload_example.php';
  79.  
  80. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/upload_example.php';
  81.  
  82. $fup = new FlexUpload($url.'?myGETVariable='.rawurlencode('you can even pass variables via GET e.g. a SESSION_ID to authenticate the user'));
  83. $fup->setMaxFileSize(5*1024*1024);
  84. $fup->printHTML(true, 'flexupload1');
  85.  
  86. ?>
  87. </p>
  88. <h3><hr width="100%"><font face="Arial, Helvetica, sans-serif">Beispiel für FlexUpload in Deutsch</font><hr width="100%"></h3>
  89. <p>
  90.  
  91. <?php
  92.  
  93. $fup = new FlexUpload($url);
  94. $fup->setMaxFileSize(5*1024*1024);
  95. $fup->setLocale('locale/de.xml');
  96. $fup->printHTML(true, 'flexupload2', false);
  97.  
  98.  
  99. ?>
  100.  
  101. <hr width="100%"><font size=-2 face="Arial, Helvetica, sans-serif"><a href="http://www.splinelab.com/flexupload/">(C) 2007 SPLINELAB</a></font>
  102. </center>
  103. </body>
  104. </html>

Documentation generated on Mon, 18 Jun 2007 21:42:51 +0200 by phpDocumentor 1.3.0RC3