$codigo = "10000";
$uploaddir = 'Images/';
$uploadfile = $uploaddir.$codigo.".jpg";
 
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) 
{
echo "El Archivo <b>$uploadfile</b> ha sido subido correctamente.";
} 
else
{
echo "El archivo no se pudo cargar en el servidor.";
}
 
 
y en el formulario:
 
<form  name="addform_g" action="addform_g.php" method="get" enctype="multipart/form-data"><div align="left">
      <table width=306 border=0 class=border>
		<tr>
    <th width=74 align=left><span class=resetas>Codigo</span></th>
    <td width=222><input type=text name=codigo readonly value=<?php echo $v = rand(10,1000000000); ?>></td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Nombre</span></th>
    <td width=222><input type=text name=nombre></td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Categoria</span></th>
    <td width=222><?php menu($num, $cons); ?> </td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Peso (Lb)</span></th>
    <td width=222><input type=text name=peso></td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Precio $</span></th>
    <td width=222><input type=text name=precio> </td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Piezas</span></th>
    <td width=222><input name=piezas type=text></td>
    </tr>
    <tr>
    <th width=74 align=left><span class=resetas> Existencia</span></th>
    <td width=222><input type=text name=existencia></td>
    </tr>
 
	<tr>
    <th><span class=resetas>Descripcion</span></th>
    <td><textarea name=descripcion cols=35 rows=5></textarea></td>
    </tr>
    <tr>
    <th><span class=resetas>Imagen</span></th>
    <td><input type="file" name=file></td>
    </tr>
 
    <tr>
    <td colspan=2 align=center>
 
    <input type=hidden name=tabla value=<?php echo $tabla; ?>>
    <input type="submit" value=Aceptar  name="submit" align=middle> 
    <input type=reset value=Borrar  align=middle> 
 
 
pero me da el error que tengo en caso de que no suba la imagen
"El archivo no se pudo cargar en el servidor" 
  
 
