uploadify.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. Uploadify v2.1.4
  4. Release Date: November 8, 2010
  5. Copyright (c) 2010 Ronnie Garcia, Travis Nickels
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. THE SOFTWARE.
  21. */
  22. if (!empty($_FILES)) {
  23. $tempFile = $_FILES['Filedata']['tmp_name'];
  24. $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
  25. $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
  26. // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
  27. // $fileTypes = str_replace(';','|',$fileTypes);
  28. // $typesArray = split('\|',$fileTypes);
  29. // $fileParts = pathinfo($_FILES['Filedata']['name']);
  30. // if (in_array($fileParts['extension'],$typesArray)) {
  31. // Uncomment the following line if you want to make the directory if it doesn't exist
  32. // mkdir(str_replace('//','/',$targetPath), 0755, true);
  33. move_uploaded_file($tempFile,$targetFile);
  34. echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
  35. // } else {
  36. // echo 'Invalid file type.';
  37. // }
  38. }
  39. ?>