wtkd

Untitled

Aug 26th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?php
  2.  
  3.  header('Access-Control-Allow-Origin: *');
  4.  include 'includes/settings.php';
  5.  
  6. //set where you want to store files
  7. //in this example we keep file in folder upload
  8. //$HTTP_POST_FILES['ufile']['name']; = upload file name
  9. //for example upload file name cartoon.gif . $path will be upload/cartoon.gif
  10.  
  11. $path= "upload/".$HTTP_POST_FILES['ufile']['name'];
  12. if($ufile !=none)
  13. {
  14. if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
  15. {
  16. echo "Successful<BR/>";
  17.  
  18. //$HTTP_POST_FILES['ufile']['name'] = file name
  19. //$HTTP_POST_FILES['ufile']['size'] = file size
  20. //$HTTP_POST_FILES['ufile']['type'] = type of file
  21.  
  22. echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>";
  23. echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
  24. echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
  25. echo "<img src=\"$path\" width=\"150\" height=\"150\">";
  26. }
  27. else
  28. {
  29. echo "Error";
  30. }
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment