I have run into a very strange problem that I hope someone may know the answer to. I have created a script upload.php3 to upload files to my web server. Snippet below:
<HTML>
<BODY>
<?
if ($photo2 != "") {
if (is_uploaded_file($FILES['photo2']['tmp_name'])) {
copy($FILES['photo2']['tmp_name'], "/tmp/photo.jpg");
echo "FILESIZE:" . $FILES['photo2']['size'] . ":<BR>";
echo "TYPE:" . $FILES['photo2']['type']. ":<BR>";
}
}
?>
<form action="/upload.php3" enctype="multipart/form-data" method="POST">
Add another photo to a Boat photo ad...<hr>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Photo: <input type='file' name='photo2'>
<br><br><input type='submit' name="submit" value='Upload ...'>
</form>
</body>
</html>
This works fantastic when the file is named upload.php3. However, I get corrupted uploads when the file is named upload.php. I know there is the answer to just name it upload.php3, however a couple issues with doing that:
It will continue to bug me why it would not worked named upload.php 🙂
I have a larger application that has a number of files with the .php instead of .php3 extension and it would be quite a task to go through a renaming convention.
Can anyone suggest what the fix may be for this? I am running php4.2.2 and apache2.0.40.
Thank you!