Menu

[r788]: / swfupload / trunk / samples / demos / featuresdemo / upload.php  Maximize  Restore  History

Download this file

75 lines (72 with data), 2.3 kB

 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
session_start();
$upload_good = false;
if (!isset($_FILES["Filedata"])) {
$upload_good = "Not recieved, probably exceeded POST_MAX_SIZE";
}
else if (!is_uploaded_file($_FILES["Filedata"]["tmp_name"])) {
$upload_good = "Upload is not a file. PHP didn't like it.";
}
else if ($_FILES["Filedata"]["error"] != 0) {
$upload_good = "Upload error no. " + $_FILES["Filedata"]["error"];
} else {
$upload_good = "The upload was good";
}
?>
<p>Upload Page</p>
<p>Here is the list of cookies that the agent sent:</p>
<ul>
<?php
foreach ($_COOKIE as $name => $value) {
echo "<li>";
echo htmlspecialchars($name) . "=" . htmlspecialchars($value);
echo "</li>\n";
}
?>
</ul>
<p>Here is the list of query values:</p>
<ul>
<?php
foreach ($_GET as $name => $value) {
echo "<li>";
echo htmlspecialchars($name) . "=" . htmlspecialchars($value);
echo "</li>\n";
}
?>
</ul>
<p>Here is the list of post values:</p>
<ul>
<?php
foreach ($_POST as $name => $value) {
echo "<li>";
echo htmlspecialchars($name) . "=" . htmlspecialchars($value);
echo "</li>\n";
}
?>
</ul>
<p>Here is the list of the files uploaded:</p>
<ul>
<?php
foreach ($_FILES as $name => $value) {
echo "<li>";
echo htmlspecialchars($name) . "=" . htmlspecialchars($value["name"]);
echo "</li>\n";
}
?>
</ul>
<p>Filedata upload status: <?php echo $upload_good; ?>.</p>
<p>Here is the current session id:</p>
<p><?php echo htmlspecialchars(session_id()); ?></p>
<p>Compare this to the session id displayed near the top of the Features Demo page. The Flash Player plug-in does not send the correct cookies in some browsers.</p>
<p>Here are some special characters:</p>
<p>Unicode: ☺☻♂♂♠♣♥♦</p>
<p>"\r\n\u0040\x40\004</p>
<p>The above line should say: quote backslash r backslash n backslash u 0 0 4 0 backslash x 4 0 backslash 0 0 4</p>
<p>If you see any @ signs the escaping didn't work right.</p>
<?php
if (isset($_POST["please_return"]) && is_numeric($_POST["please_return"])) {
$status_code = $_POST["please_return"];
echo "Return HTTP Status Code $status_code as requested";
header("HTTP/1.1 $status_code Custom Status Code");
}
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.