how can i put image in the "Browse" button on system "UploadImage" example: and how i cant put image for the "text box" on the "UploadImage" system example: the code: <?php define("MAX_FILE_SIZE", 100); define("UPLOAD_DIR", "**censored **\**censored **\**censored *\*censored **\img"); $FileTypes = array("image/pjpeg", "image/gif", "image/jpg", "image/png"); ?> <html> <center> <head> <title></title> </head> <body> <img src="images/logo.gif"> <BODY background="images\main-bg.gif"> </BODY> <br><br> <?php if(!@$_POST['image']) { ?> <form enctype="multipart/form-data" action=<?php echo '"'.$_SERVER['PHP_SELF'].'"'; ?> method="POST"> <input type="file" name="file" size=img="images\bro.gif"> <br><br> <input type="image" name="image" src="***\***\***\***\images\up.gif" > </form> <?php echo date("j/n/Y H:i" , time() ); } else { //echo $_FILES['file']['type'].'<BR>'; $is_ValidType = false; foreach($FileTypes as $Type) { if($_FILES['file']['type'] == $Type) { $is_ValidType = true; break; } } if($is_ValidType) if(($_FILES['file']['size']/1024) > MAX_FILE_SIZE) echo "File is too big. Maximum size allowed is ".MAX_FILE_SIZE." kb."; else if(move_uploaded_file($_FILES['file']['tmp_name'], UPLOAD_DIR."\\".$_FILES['file']['name'])) echo "File was succefully uploaded!"; else echo "Uploading failed. Please try again."; else echo "Wrong file type."; } ?> </body> </center> </html> PHP:
Not with PHP. Actually I'm not even sure if this is possible without Flash or javascript. Oh yeah, and your script is pretty insecure. Don't rely on the type value in the $_FILES array since it comes from the client and can not be trusted.