<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function popupUploadImage( f_name, e_name, path ) { window.open("./popUploadImages.php","name","top=300,left=450,height=250,width=400, status=1"); } </script> </head> <body> <img src="" name="pImage" id="pImage"/> <br /> <a href="#" onclick="popupUploadImage();"><b>[ Browse ]</b></a><br /> </body> </html>
<html> <head> <title>Upload Images</title> </head> <body> <form name="uploadImage" action="uploadImages.php" method="post" enctype="multipart/form-data"> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="darkbrown12_bold">?</td> </tr> <tr> <td class="darkbrown12_bold"><div align="center">Select Image</div></td> </tr> <tr height="35"> <td align="center"><input type="file" name="file" class="inputBox" size="30"></td> </tr> <tr height="35"> <td align="center">?</td> </tr> <tr height="35"> <td align="center"> <input type="submit" name="submitPage" value="upload" class="button80"> </td> </tr> </table> </form> </body> </html>
<?php if($file){ $path = "images/"; $fileType = explode('.', $file_name); $fileName = date('YmdHis'); $fileName = $fileName.".".$fileType[1]; $uploadFile = $path."".$fileName; copy($file, $uploadFile); $img = "./images/$fileName"; $Ipreview = "pImage"; } ?> <html> <head> <script language="javascript"> function returnValue() { window.opener.document.getElementById('<? echo $Ipreview?>').src = "<?php echo $img ?>"; window.close(); } </script> </head> <body onLoad="returnValue()"> </body> </html>