not able to upload multiple images on the body of the editor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpquery
Forum Newbie
Posts: 13
Joined: Thu Dec 04, 2008 3:29 am

not able to upload multiple images on the body of the editor

Post by phpquery »

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"

Code: Select all

 
 
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&#058;window.print();
}
function find1()
{
    javascript&#058;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>
 
[php]
 
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"

Code: Select all

 
 
<?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 />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <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
Attachments
upload_MORE_THAN_ONE_IMAGE.jpg
upload_MORE_THAN_ONE_IMAGE.jpg (55.99 KiB) Viewed 75 times
front end_IMAGE.jpg
front end_IMAGE.jpg (42.16 KiB) Viewed 75 times
phpquery
Forum Newbie
Posts: 13
Joined: Thu Dec 04, 2008 3:29 am

Re: not able to upload multiple images on the body of the editor

Post by phpquery »

Hi friends,

any resolutions to my queries?

thanx,

phpquery
Post Reply