Advertisement
gdhami

Resumable PHP Upload (2)

Mar 11th, 2012
50
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.     $file_name        = 'D:\xampp\htdocs\_tests\resume\sql-dump.sql';
  6.     $file_handle      = fopen($file_name, "a+");
  7.     $php_input_handle = fopen("php://input", "r");
  8.  
  9.     while ( $data_chunk = fread($php_input_handle, 4096) )
  10.     {
  11.         $length_chunk = strlen($data_chunk);
  12.         fwrite($file_handle, $data_chunk, $length_chunk );
  13.     }
  14.  
  15.     fclose($file_handle);
  16.     fclose($php_input_handle);
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement