-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencoding.php
More file actions
46 lines (34 loc) · 897 Bytes
/
encoding.php
File metadata and controls
46 lines (34 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
*/
if(isset($_POST["submit"]) && isset($_FILES["fileToUpload"]["name"]))
{
if ($_FILES["fileToUpload"]["size"] > 5000000) {
echo "dosya cok buyuk!";
exit;
}
$file=$_FILES["fileToUpload"]["tmp_name"];
$filename=$_FILES["fileToUpload"]["name"];
$myfile = fopen($file, "r");
$data = fread($myfile, filesize($file));
fclose($myfile);
$str = mb_convert_encoding($data, "utf-8", "Windows-1254");
header('Cache-control: public');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . strlen($str));
header('Content-Disposition: attachment; filename=' . $filename);
flush();
echo $str;
exit;
}
?>
<!DOCTYPE html>
<html>
<body>
<form action="" method="post" enctype="multipart/form-data">
Encoding file:
<input type="file" name="fileToUpload" id="fileToUpload"><br>
<input type="submit" value="Encoding file" name="submit">
</form>
</body>
</html>