Advertisement
gdhami

Resumable PHP Upload (3)

Mar 12th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     set_time_limit(0);
  3.     header('Content-Type: text/html; charset=utf-8');
  4.  
  5.     if ( $temp_file_handle = fopen($_FILES['upload_file']['tmp_name'], "r") )
  6.     {
  7.             $file_name   = 'D:\xampp\htdocs\_tests\resume\final-file.bin';
  8.         $file_handle = fopen($file_name, "a");
  9.  
  10.         while ( $data_chunk = fread($temp_file_handle, 4096) )
  11.         {
  12.             $length_chunk = strlen($data_chunk);
  13.             fwrite( $file_handle, $data_chunk, $length_chunk );
  14.         }
  15.  
  16.         fclose($file_handle);
  17.         fclose($temp_file_handle);
  18.     }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement