Changes in Upload function to accomdate for the reponse body still not functional
[xiph/unicode.git] / oggPusher / Server / post.php
blob2142fe1f9efe755c17c22a61d1c1e9f8fe1f7c7f
1 <?
2 print_r($_FILES);
3 ?>
4 <hr>
5 <?
6 print_r($_POST);
8 $fpath = "/var/www/uploads/";
9 $file_name = $fpath . basename($_FILES{'myfile'}{'name'});
10 echo $file_name;
12 // move (actually just rename) the temporary file to the real name
13 move_uploaded_file ( $_FILES{'myfile'}{'tmp_name'}, $file_name );
15 // convert the uploaded file back to binary
17 // javascript "escape" does not encode the plus sign "+", but "urldecode"
18 // in PHP make a space " ". So replace any "+" in the file with %2B first
20 $filename = $file_name;
21 $handle = fopen($filename, "r");
22 $contents = fread($handle, filesize($filename));
23 fclose($handle);
25 $contents = preg_replace("/\+/", "%2B", $contents);
27 $handle = fopen($filename, "w");
28 fwrite($handle, urldecode($contents));
29 fclose($handle);