note 3343 deleted from features.file-upload by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 00:22:37 +0000 |
| Subject: | note 3343 deleted from features.file-upload by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24047@lists.php.net to get a copy of this message | ||
This will help for you windows users (note - this was tested in Windows 98, Apache 1.3.9 with PHP3)
<PRE>
<?
function do_upload($FileName) {
// NOTE WINDOWS USERS!
// You must use "\\" instead of "\" in your paths!
$tmp_upload_path = "c:\\apache\\upload_tmp\\";
$file = basename($FileName);
$new_file_name = "c:\\apache\\upload_tmp\\filename.txt";
if ( $userfile == "none" ) {
$error_msg = "You did not specify a file for uploading.";
return;
}
if ( $userfile_size > 2097152 ) {
$error_msg = "Sorry, your file is too large.";
return;
}
if (!copy($tmp_upload_path.$file, $new_file_name)) {
$error_msg = "failed to copy $file...<br>\n";
return;
}
}
?>
<HTML>
<HEAD><TITLE>RECEIVE FILE</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF"
VLINK="#800080">
<?
do_upload($userfile);
?>
<TABLE>
<TR>
<TD>USER FILE:</TD><TD><? echo $userfile; ?></TD>
</TR>
<TR>
<TD>USER FILE NAME:</TD><TD><? echo $userfile_name; ?></TD>
</TR>
<TR>
<TD>USER FILE SIZE:</TD><TD><? echo $userfile_size; ?></TD>
</TR>
<TR>
<TD>USER FILE TYPE:</TD><TD><? echo $userfile_type; ?></TD>
</TR>
</TABLE>
<?
if ( $error_msg ) {
echo "<B> $error_msg </B>";
}
else {
echo "<B> File upload successful! </B>";
}
?>
</BODY>
</HTML>
</PRE>