Project

General

Profile

1 3998 berkley
<?
2
print_r($_FILES);
3
?>
4
<hr>
5
<?
6
print_r($_POST);
7
8
$fpath = "/tmp/";
9
10
// move (actually just rename) the temporary file to the real name
11
move_uploaded_file ( $_FILES{myfile}{tmp_name}, $fpath.$_FILES{myfile}{name} );
12
13
// convert the uploaded file back to binary
14
15
// javascript "escape" does not encode the plus sign "+", but "urldecode"
16
//	in PHP make a space " ". So replace any "+" in the file with %2B first
17
18
$filename = $fpath.$_FILES{myfile}{name};
19
$handle = fopen($filename, "r");
20
$contents = fread($handle, filesize($filename));
21
fclose($handle);
22
23
$contents = preg_replace("/\+/", "%2B", $contents);
24
25
$handle = fopen($filename, "w");
26
fwrite($handle, urldecode($contents));
27
fclose($handle);
28
29
?>