| Server IP : 23.94.149.180 / Your IP : 216.73.216.147 Web Server : nginx/1.20.1 System : Linux deadrock 5.14.0-741.22.1.el9_9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 12 15:18:14 UTC 2026 x86_64 User : apache ( 48) PHP Version : 8.6.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /files/www/voxsupport/files/fancy/docs/userguide/HTML/ |
Upload File : |
<html>
<head>
<title>PHP example</title>
<meta name="generator" content="Help & Manual">
<meta name="keywords" content="">
</head>
<!-- Redirect browser to index page if page is not in the content frame.
This script is only valid for regular HTML export -->
<script language="JavaScript">
<!--
if(top.frames.length==0) top.location.href='index.html?phpexample.html'
//-->
</script>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#E2E2E2">
<tr>
<td align="left">
<span style="font-family:Helvetica,Arial; font-size:12pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:12pt; color:#000080"><b>PHP example
<br>
</b></span></span>
</td>
<td align="right">
<font face="Arial" size="2">
<a href="javaScript:parent.reDisplay('1.1',1,0)"><img src="ico_nav_up.gif" border=0 alt="Top"></a>
<a href="javaScript:parent.reDisplay('3.1',1,0)"><img src="ico_nav_back.gif" border=0 alt="Previous"></a>
<a href="javaScript:parent.reDisplay('3.3',1,0)"><img src="ico_nav_next.gif" border=0 alt="Next"></a>
</font>
</td>
</tr>
</table>
<br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The example below demonstrates how using a PHP script you can process files submitted by HTTP File Upload Applet. The source code for this example may be found in the <span style="font-family:Courier New; font-size:10pt; color:#000000">examples/php/receiver.php</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> file included with the HTTP File Upload Applet distribution.
<br>
<br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#008000"><b>Example</b></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
<br>
</span><span style="font-family:Courier New; font-size:10pt; color:#000000"><?
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>// define upload directory, notice that permissions to write are needed for upload directory </i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$uploaddir = <span style="font-family:Courier New; font-size:10pt; color:#000080">'/var/uploads/'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>// get upload filename</i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
$uploadfile = $uploaddir . basename($_FILES[<span style="font-family:Courier New; font-size:10pt; color:#000080">'file'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">][<span style="font-family:Courier New; font-size:10pt; color:#000080">'name'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">]);
<br>
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>// add Connection: close header</i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
header(<span style="font-family:Courier New; font-size:10pt; color:#000080">"Connection: close"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">);
<br>
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>// move uploaded file from temporary location to upload directory</i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
<span style="font-family:Courier New; font-size:10pt; color:#000080">if</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"> (move_uploaded_file($_FILES[<span style="font-family:Courier New; font-size:10pt; color:#000080">'file'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">][<span style="font-family:Courier New; font-size:10pt; color:#000080">'tmp_name'</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">], $uploadfile)) {
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>//if succeeded, print out the "success" code to notify applet the file was uploaded </i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
echo <span style="font-family:Courier New; font-size:10pt; color:#000080">"RESP.100"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>
} <span style="font-family:Courier New; font-size:10pt; color:#000080">else</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000"> {
<br>
<span style="font-family:Courier New; font-size:10pt; color:#008000"><i>//if failed for some reason, print out the "failed" code to notify applet the file wasn't uploaded </i></span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">
<br>
echo <span style="font-family:Courier New; font-size:10pt; color:#000080">"RESP.200"</span></span><span style="font-family:Courier New; font-size:10pt; color:#000000">;
<br>
}
<br>
?>
<br>
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Installation</b>
<br>
<br>
</span></span><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">1.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Change <span style="font-family:Courier New; font-size:10pt; color:#000000">$uploaddir</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> variable in </span><span style="font-family:Courier New; font-size:10pt; color:#000000">receiver.php</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> script to point to directory path where file should be uploaded. Make sure to include a </span><span style="font-family:Courier New; font-size:10pt; color:#000000">/</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> at the end.
<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">2.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Upload <span style="font-family:Courier New; font-size:10pt; color:#000000">receiver.php</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> to your web server in a directory that is accessible.
<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">3.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Set <span style="font-family:Courier New; font-size:10pt; color:#000000">url</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"> parameter in HTML applet code to point to url of this script e.g. </span><span style="font-family:Courier New; font-size:10pt; color:#000000">http://www.mydomain.com/receiver.php</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="28"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">4.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">Done. You may now run HTTP File Upload Applet
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>See also</b>
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span></td><td></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><a href=javaScript:parent.reDisplay('2.8',1,0)>Specifying the upload URL</a>
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span>
</body>
</html>