So I'm using this script to upload a .htm file, the only problem is after I upload the file the extension is gone and doesn't display as a web page. If I go into the folder and rename the file to vsquarel.htm the file displays as a web page again. So my question is how do I upload a .htm file and keep the file type?
Here's the code:

<?php

$file_name = $HTTP_POST_FILES['ufile']['name'];

$new_file_name=vsquarel;

$path= "vsql/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>"; 

echo "File Name :".$new_file_name."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; 
}
else
{
echo "Error";
}
}
?>
$new_file_name=vsquarel;

I think that this line is incorrect? Possibly it should be:

$new_file_name="vsquarel";

or even:

$new_file_name="vsquarel.htm";

Unless vsquarel is supposed to be a variable, in which case it should be:

$new_file_name=$vsquarel;

Try these suggestions and see if that fixes your problem... :)

Ya all it needed was "vsquarel.htm" and it worked, thanks for your help

This question has already been answered. Start a new discussion instead.