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:


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


$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/>"; 
echo "Error";

Recommended Answers

All 2 Replies


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


or even:


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


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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.