Dear i have this html form : <form enctype="multipart/form-data" action="add-nokiathemespublic.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="3072000" /> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="555" id="AutoNumber2"> <tr> <td width="215">Title Of Theme: </td> <td width="337"> <input type="text" name = "email" size="20"></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="555" id="AutoNumber3"> <tr> <td width="217">SIS File Location On Your PC: </td> <td width="338"> <input type="file" name = "file" size="20"></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="555" id="AutoNumber4"> <tr> <td width="218">Photo Location On Your PC: </td> <td width="337"> <input type="file" name="photo" size="20"></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5"> <tr> <td> <p align="center"> <input type="submit" value="Upload Theme"> </td> </tr> </table> </form> HTML: What i want if people don't have photo, they just leave photo field empty and automatically when this form is clicked, an nopreview.gif is filled in that field.
It would be easier and safer to handle that in your PHP code, in my opinion, than to do it with client-side Javascript. Use PHP's is_uploaded_file()