السلام عليكم لدي مربع تحرير نصوص textare وفوقه زر لرفع الصورة اريد ان اقوم برفع الصورة تلقائى تنزل فى ال textarea
فقمت بعمل هذا الكود
اولا الصفحة التى بها المحرر او مربع النصوص
<form>
<input type="button" class="button" name="UpImg" value="رفـــــــــع صور اخرى بالاعلان" onClick="window.open('up.php', 'Uploads', 'width=400,height=150,resizable=0,menubar=0,locati on=0,status=0,toolbar=0')"></td>
<textarea id="sujet" name="sujet" rows="25" cols="59"></textarea>
</form>ثانيا صفحة up.php والتى بها استعراض الصور
<form name=uploud method="POST" action="upload2.php" enctype="multipart/form-data" >
<input class="btn" value="رفع الصورة" type="submit" name="action"></td>
<input class=TEXTPUT type="file" name="my_files" size="20" dir="ltr" ></td>
</form>ثالثا صفحه رفع الصورة upload2.php
<?php
$picat=time();
$upload_dir = "pic/";
$upload_url = $url_dir."pic/";
$temp_name = $_FILES['my_files']['tmp_name'];
$file_name = $_FILES['my_files']['name'];
$file_name = str_replace("\\","",$file_name);
$file_name = str_replace("'","",$file_name);
$ext=strstr($file_name,'.');
$picu="temp_".$picat.$ext;
$file_path = $upload_dir.$picu;
$ext = str_replace(".","",$ext);
if($ext=='jpg' || $ext=='JPG' || $ext=='gif' || $ext=='GIF' || $ext=='png' || $ext=='PNG' || $ext=='bmp' || $ext=='BMP' ) {
move_uploaded_file($temp_name, $file_path);
$picu=$picu;
$fsize=filesize("$file_path");
?>
<script type="text/javascript" src="js/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
var tempUrl = "<?php echo 'pic/'.$picu;?>";
window.opener.$("#note").document.execCommand("inserthtml", "<a id=example2 href=\"" + tempUrl + "\"><img src=\"" + tempUrl + "\"></img></a>", null , null);
window.close();
</script>المفروض هنا بعد رفع الصورة تغلق الصفحة وتضع الصورة بالمحرر لكنها لا تفعل ذلك الصورة ترفع بشكل سليم لكن لا تضعها بالمحرر ولا تغلق الصفحة بعد الرفع
