phpquery Posted February 21, 2009 Share Posted February 21, 2009 Hello, Please take a moment to look at the following codes. We are trying to create a user friendly editor & one of the features we are trying to add is the upload image functionality. Now we are able to upload one image ONLY. What we need is the ability to add multiple images. Attached are screen shots. In the screen shot named "front end_IMAGE" it shows that we have uploaded one image. Now i click on the Upload Image button again & the pop up for locating the image is shown which can be seen in screen shot named "upload_MORE_THAN_ONE_IMAGE"........If i now select the new image & click on upload> then i refresh the page > then the first image is deleted & second image is uploaded. So my issues are the following, 1) How do i resolve the issue where i can see the image as soon as it is uploaded. I dont want to refresh the page. It should automatically show in the front end as soon as i upload the image from a particular location. 2) How do i upload more than one images, without the first image getting deleted. CODE FOR screen shot named "front end_IMAGE" if(isset($_SESSION['img'])) { <?php session_start(); ?> <!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="application/javascript"> function pt() { javascript:window.print(); } function find1() { javascript:window.find(); } </script> </head> <body> <FORM> <INPUT type="button" value="Upload Image" onClick="window.open('http://localhost/krishna/editor_trial/edt.php','mywindow','width=400,height=100,toolbar=no,location=no,status=no')"> </FORM> <FORM name="form1" action="" method="post"> <label> <p><textarea name="textarea" id="textarea" cols="70" rows="10" style="background-color:<?php echo "#".$_GET['cl']; ?>"><?php if(isset($_SESSION['img'])) { echo "<img src='".$_SESSION['img']."'/>"; } ?></textarea> </label> <p> <INPUT type="submit" value="Submit"> </FORM> [code=php:0] if(isset($_SESSION['img'])) { echo "<img src='".$_SESSION['img']."'/>"; } </body> </html> echo "<img src='".$_SESSION['img']."'/>"; } CODE FOR screen shot named "upload_MORE_THAN_ONE_IMAGE" <?php session_start(); ?> <!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="application/javascript"> </script> </head> <body> <FORM ENCTYPE="multipart/form-data" ACTION="" METHOD="post"> <p> <label> <input name="userfile" type="file"> </label> <label> <input type="submit" name="file_uploaded" id="button" value="upload"/> </label> <br /> <br /> <INPUT type="button" value="OK" name="ok" onClick="window.close()"> </form> <?php if(isset($_POST['file_uploaded'])) { if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { $file_realname = $_FILES['userfile']['name']; copy($_FILES['userfile']['tmp_name'], "E:/wamp/www/krishna/editor_trial/images/".trim($file_realname)); } $_SESSION['img']='images/'.$file_realname; } ?> </html> thanks in advance, php query [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/146231-not-able-to-upload-more-than-one-image-on-the-body-of-the-editor/ Share on other sites More sharing options...
phpquery Posted February 24, 2009 Author Share Posted February 24, 2009 hello friends, did you get a chance to look at my queries? Any resolutions to my queries. thanx, phpquery Link to comment https://forums.phpfreaks.com/topic/146231-not-able-to-upload-more-than-one-image-on-the-body-of-the-editor/#findComment-769965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.