<Tr bgcolor = "# f5f5f5">
<Td height = "30" align = "center" valign = "middle"> image link </td>
<Td height = "35" align = "center" valign = "middle"> <input type = "file" name = "uploadfile1" runat = "server" id = "uploadfile1" onpropertychange = "document. all. imgID. src = 'file: // '+ this. value "> & nbsp;
</Td>
</Tr>
<Tr bgcolor = "# f5f5f5">
<Td height = "70" align = "center" valign = "middle"> thumbnail </td>
<Td height = "70" align = "center" valign = "middle"> & nbsp;
</Td>
</Tr>
Background code:
String fullFileName = this. fileUpLoad. PostedFile. FileName;
String fileName = fullFileName. Substring (fullFileName. LastIndexOf ("//") + 1 );
String typeName = fullFileName. Substring (fullFileName. LastIndexOf (".") + 1 );
If (typeName! = "Jpg" & typeName! = "Bmp" & typeName! = "Gif ")
{
Response. Write ("<script> alert ('the format of the image to be uploaded is incorrect! '); </Script> ");
}
Else
{
This. fileUpLoad. PostedFile. SaveAs (Server. MapPath ("picture") + @ "/" + fileName );
Response. Write ("<script> alert ('added successfully'); </script> ");
}