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]