content-type added to php copy, changes file size , adds content-type to start of file
| From: | Wade Peacock | Date: | Sun, 06 May 2001 00:11:24 +0000 |
| Subject: | content-type added to php copy, changes file size , adds content-type to start of file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51580@lists.php.net to get a copy of this message | ||
Hello Gurus,
I have an issue, that I am trying to figure out if it is an Apache config
issue or a PHP issue.
I have written a script to upload file to a directory on my RH7.0 Linux
Apache server. directory has been chmod 777.
I have a problem with my php uploads. the content-type is added at the
beginning of uploaded file. this makes file useless on server. here is my
code for my upload page.
<?php
$archive_dir="../test";
if ($upload) {
$filename = basename($userfile_name);
if(!copy($userfile, "$archive_dir/$filename")) die ("$filename not
copied! - Error!");
echo "File $filename Uploaded";
}
?>
<table border="0" width="751">
<tr>
<td>
<form method="post" enctype="multipart/form-data" action="<? echo
$PHP_SELF
?>">
Upload file!
<input type="file" name="userfile">
<input type="SUBMIT" name="upload" VALUE="upload">
</form>
</td>
</tr>
</table>
Any thoughts would be appreciated.
wade