Please post your code/site so we can find the possible errors in your code.
Thanks, Death
With u r response i am sending link of my site " www.storyclix.c om" in that go to "add my story" and in that media section is there. try to upload multiple images u can find the problem easily. Problem is in firefox not in IE in IE it is uploading correctly.
<?php
function Compress_Gen_Th umb_Image($ori_ file, $new_file, $ext)
{
//echo "<br>Src file = ".$ori_file ." Dest file = ".$new_file ." Ext = ".$ext;
$zzzzz = explode('.',$ne w_file);
$size = 0.99;
list($oriw, $orih) = getimagesize(tr im($ori_file));
//echo "<BR>Origin al : Width = ".$oriw." , Height= ".$orih;
$wid = $oriw;
$hei = $orih;
$dest_file = "";
$filename = "";
$new_file = 'temp/'.$new_file;
while(($wid>65) ||($hei>65))
{
$wid = $oriw * $size;
$hei = $orih * $size;
$size = $size - 0.01;
}
//echo "<BR>Thumb : Width = ".$wid." , Height= ".$hei;
if(($ext=='jpg' )||($ext=='jpeg '))
{
// Resizing the Image
$tn = imagecreatetrue color($wid, $hei);
$image = imagecreatefrom jpeg($ori_file) ;
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $wid, $hei, $oriw, $orih);
// Outputting a .jpg, you can make this gif or png if you want
//notice we set the quality (third value) to 100
imagejpeg($tn, $new_file, 100);
}
if($ext=='gif')
{
$tn = imagecreatetrue color($wid, $hei);
$image = imagecreatefrom gif($ori_file);
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $wid, $hei, $oriw, $orih);
imagegif($tn, $new_file);
}
if($ext=='png')
{
$tn = imagecreatetrue color($wid, $hei);
$image = imagecreatefrom png($ori_file);
imagecopyresamp led($tn, $image, 0, 0, 0, 0, $wid, $hei, $oriw, $orih);
imagepng($tn, $new_file);
}
}
function Generate_Versio ning_name($fnam e)
{
if(file_exists( $fname))
{
$filee = $fname;
$count = 0;
$temp_splited_d ir = explode('/',$filee);
$filename = $temp_splited_d ir[1];
$temp_splited_f ile = explode('.',$te mp_splited_dir[1]);
$new_f_name = "temp/".$temp_splited _file[0].".".$temp_spli ted_file[1];
$thumb_image = trim($temp_spli ted_file[0])."_1.".trim($t emp_splited_fil e[1]);
$count = 1;
if(file_exists( $new_f_name)==' 1')
{
while(File_Exis ts_or_Not($new_ f_name)=="true" )
{
$new_f_name = 'temp/'.$temp_splited _file[0]."_".$count."." .$temp_splited_ file[1];
$thumb_image = trim($temp_spli ted_file[0])."_".$count."_ 1.".trim($temp_ splited_file[1]);
$count = $count + 1;
}
$newfile = $new_f_name;
}
else
{
$newfile = $new_f_name;
}
}
else
{
$temp_splited_d ir = explode('/',$fname);
$filename = $temp_splited_d ir[1];
$temp_splited_f ile = explode('.',$te mp_splited_dir[1]);
$thumb_image = trim($temp_spli ted_file[0])."_1.".trim($t emp_splited_fil e[1]);
$newfile = $fname;
}
return $newfile."#".$t humb_image;
}
function File_Exists_or_ Not($FILE)
{
if(file_exists( $FILE))
{
return "true";
}
else
{
return "false";
}
}
$ftmp = $_FILES['image0']['tmp_name'];
$oname = $_FILES['image0']['name'];
$fname = 'temp/'.$_FILES['image0']['name'];
$exteee = strrev($oname);
$revext = substr($exteee, 0,strrpos($exte ee,'.'));
$ext = strtolower(strr ev($revext));
if(($ext=='jpeg ')||($ext=='jpg ')||($ext=='gif ')||($ext=='png '))
{
$filetype = 'IMAGE';
}
if($ext=='flv')
{
$filetype = 'VIDEO';
}
if($ext=='mp3')
{
$filetype = 'AUDIO';
}
if($_FILES['image0']['name']!='')
{
$filee = $fname;
$newfile = Generate_Versio ning_name($fnam e);
$ori_thumb_imag e_names = explode('#',$ne wfile);
$newfile = $ori_thumb_imag e_names[0];
$thumb_image = $ori_thumb_imag e_names[1];
//echo "<br>ori : ".$newfile."<br >thum : ".$thumb_im age;
}
if($ext=='flv')
{
if($_FILES['image1']['name']!='')
{
$ftmp1 = $_FILES['image1']['tmp_name'];
$oname1 = $_FILES['image1']['name'];
$fname1 = 'temp/'.$_FILES['image1']['name'];
$newfile1 = Generate_Versio ning_name($fnam e1);
$ori_thumb_imag e_names = explode('#',$ne wfile1);
$newfile1 = $ori_thumb_imag e_names[0];
$thumb_image = $ori_thumb_imag e_names[1];
//echo "<br>VIDEO ori : ".$newfile1."<b r>VIDEO thum : ".$thumb_im age;
$aaa = move_uploaded_f ile($ftmp1, $newfile1);
$cccccc = explode('.',$th umb_image);
$aa = Compress_Gen_Th umb_Image($newf ile1,$thumb_ima ge,$cccccc[1]);
}
}
if(move_uploade d_file($ftmp, $newfile)){
if($filetype==' IMAGE')
{
$aa = Compress_Gen_Th umb_Image($newf ile,$thumb_imag e,$ext);
}
?>
<html><head>
<script type="text/javascript" src="ufo.js"></script>
<script>
var par = window.parent.d ocument;
var images = par.getElementB yId('images');
var display_str = '';
var totalfiles='';
var filetypes='';
var filedescrips='' ;
var filecontimg='';
var ty='';
ty = '<? echo $filetype; ?>';
var FILES,TYPES,DES CS,CIMGs;
var i;
if(ty=='VIDEO')
{
window.parent.d ocument.getElem entById('files' ).value = window.parent.d ocument.getElem entById('files' ).value + "<? echo $newfile.'#'.$n ewfile1.'#temp/'.$thumb_image; ?>" + "~";
}
else
{
window.parent.d ocument.getElem entById('files' ).value = window.parent.d ocument.getElem entById('files' ).value + "<? echo $newfile.'#'.'t emp/'.$thumb_image; ?>" + '~';
}
//window.parent.d ocument.getElem entById('files' ).value = window.parent.d ocument.getElem entById('files' ).value + '<? echo $newfile; ?>' + '~';
window.parent.d ocument.getElem entById('type') .value = window.parent.d ocument.getElem entById('type') .value + '<? echo $filetype; ?>' + '~';
window.parent.d ocument.getElem entById('file_d esc').value = window.parent.d ocument.getElem entById('file_d esc').value + window.parent.d ocument.getElem entById('edit[attach_desc]').value +'~';
//Ramesh added
window.parent.d ocument.getElem entById('edit[attach_desc]').value = '';
window.parent.d ocument.getElem entById('desc_c har_count').inn erHTML = '100';
totalfiles = window.parent.d ocument.getElem entById('files' ).value;
FILES = totalfiles.spli t('~');
filetypes = window.parent.d ocument.getElem entById('type') .value;
TYPES = filetypes.split ('~');
filedescrips = window.parent.d ocument.getElem entById('file_d esc').value;
DESCS = filedescrips.sp lit('~');
display_str = '<DIV id="Total_Image s_DIV" name="Total_Ima ges_DIV" style="overflow :auto; width:850px; border:1px solid black; height:270px; display:block;" >';
display_str += "<table border=0 width=10% height=100% cellpadding=0 cellspacing=0 valign=top><tr> ";
for(i=0;i<TYPES .length-1;i++)
{
display_str += "<td valign=top><DIV valign=middle name='Table"+i+ "' id='Table"+i+"' style='display: block;width:200 px;height:250px ;overflow:auto; '>";
display_str += "<table border=0 width=98% height=96% cellpadding=0 cellspacing=0 valign=top>";
display_str += "<tr height=1><td align=center><b >"+TYPES[i]+"</b></td></tr>";
if(TYPES[i]=='IMAGE')
{
var cccc = FILES[i].split('#');
display_str += "<tr height='100' valing='middle' ><td align=center><i nput type=hidden id='main_hidd" + i + "' name='main_hidd " + i + "' value='0'><img src='" + cccc[1] + "' border=0></img></td></tr>";
}
if(TYPES[i]=='VIDEO')
{
display_str += "<tr height='100' valing='middle' ><td align=center><i nput type=hidden id='main_hidd" + i + "' name='main_hidd " + i + "' value='0'>";
var ddd = FILES[i].split('#');
if(ddd[1]=='')
{
display_str += " <OBJECT codeBase='http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=7,0,0,0' height='100' width='100' classid=clsid:D 27CDB6E-AE6D-11cf-96B8-444553540000>";
display_str += ' <param name="bgcolor" value="#FFFFFF" />';
display_str += ' <param name="flashvars " value="file=' + ddd[0] + '&image=preview .jpg&autostart= false&repeat=fa lse&showfsbutto n=true" />';
display_str += ' <param name="allowfull screen" value="true" />';
display_str += ' <param name="movie" value="flvplaye r.swf" />';
display_str += ' </OBJECT>';
//display_str += "<img src='"+ddd[1]+"' border=0 width=100 height=100>";
}
else
{
display_str += "<img src='"+ddd[2]+"' border=0>";
}
display_str += "</td></tr>";
}
if(TYPES[i]=='AUDIO')
{
display_str += "<tr height='100'><t d align=center><i mg src='images/audio.png' border=0 width=100 height=100></td></tr>";
}
display_str += "<tr height='100'><t d name='file_desc " + i + "' id='file_desc" + i + "' align=left>" + DESCS[i] + "</td></tr>";
if ((TYPES[i]=='IMAGE')||(TY PES[i]=='VIDEO'))
{
display_str += "<tr height=1><td align=center><t able border=0 width='180' cellpadding=0 cellspacing=0>" ;
display_str += "<tr>";
display_str += "<td align=left valign=middle style='WHITE-SPACE : nowrap;'>";
//Ramesh
// variable 'isFirstUpload' is required only for checking first time upload(if value is 1) it is always incrementing
// variable 'cont_images' is for apearing 'tick image' when delete (from this hidden variable,taking the value and comparing, if equal tick the image)
// number is concat with this bcz if the same filename exist 'comparing will confuse'
// variable 'whichIsTick' very important for geting no of images and for concat with files...
var isFu = window.parent.d ocument.getElem entById('isFirs tUpload').value ;
if(isFu == 1){
window.parent.d ocument.getElem entById('cont_i mages').value = (i+1)+"~"+FILES[i];
//display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image </a></td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'><img border=0 src='images/make_main_img_f lag.gif'></img> ";
display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image </a></td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'><img border=0 src='images/make_main_img_f lag1.gif'></img> ";
}
else{
var mimg = window.parent.d ocument.getElem entById('cont_i mages').value;
if(mimg==((i+1) +"~"+FILES[i])) {
//display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image </a></td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'><img border=0 src='images/make_main_img_f lag.gif'></img> ";
display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image </a></td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'><img border=0 src='images/make_main_img_f lag1.gif'></img> ";
}
else{
//display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image</a> </td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'></td>";
display_str += " &nbs p;<a href='#' onclick=\"PHP_M EDIA_make_main_ image_link('" + i + "'); return false;\">Main Image</a> </td><td name='make_main _image" + i + "' id='make_main_i mage" + i + "'></td>";
}
}
//Ramesh
}
else
{
display_str += "<tr height=1><td><t able border=0 width='180' cellpadding=0 cellspacing=0>" ;
display_str += "<tr>";
}
display_str += "<td align=center valign=middle style='WHITE-SPACE : nowrap;'> <a href='#' onclick=\"del_u ploaded_files(' " + i + "'); return false;\">Delete </a> </td>";
display_str += "<td align=center valign=middle style='WHITE-SPACE : nowrap;'> <a href='#' name='pos_right " + i + "' id='pos_right" + i + "' onclick=\"Open_ EDIT_POPUP('tot al_table', 'Edit_File_Desc ', '" + i + "'); return false;\">Edit</a> </td>";
display_str += "</tr></table>";
display_str += "</td></tr></table>";
display_str += "</DIV></td>";
}
display_str += "</tr></table></DIV>";
images.innerHTM L = display_str;
//alert(display_s tr)
//par.getElementB yId('iframe').i nnerHTML ='';
par.getElementB yId('iframe').i nnerHTML ='<iframe src="upload.php " style="width:85 0px; height:120px;" frameborder="0" name="attach_fr ame" id="attach_fram e"></iframe>'
//par.getElementB yId('_Confirm_b uttons').style. display = 'none';
//par.getElementB yId('_Upload_bu ttons').style.d isplay = 'block';
</script>
</head>
</html>
<?php
exit();
}
?><html><head>
<link rel="stylesheet " href="themes/wakapa/style.css" type="text/css">
<script language="javas cript">
function upload()
{
var fileurl='';;
var i;
var urllength;
var urllength1;
var revstr='',revst r1='';
var ext='',ext1='';
var revext='',revex t1='';
var extlen,extlen1;
var FileDesc='';
var _errMsg='';
var par = window.parent.d ocument;
var images = par.getElementB yId('images');
fileurl = document.getEle mentById('image 0').value;
fileurl1 = document.getEle mentById('image 1').value;
urllength = fileurl.length;
urllength1 = fileurl1.length ;
if(fileurl1!='' )
{
for(i=urllength 1;i>=0;i--)
{
// reverse the thumbnail file path to get Extension
revstr1 = revstr1 + fileurl1.substr ing(i,i-1);
}
}
for(i=urllength ;i>=0;i--)
{
// reverse the file path to get Extension
revstr = revstr + fileurl.substri ng(i,i-1);
}
// Get the extension in reverse format
revext = revstr.substrin g(0,(revstr.ind exOf('.')));
revext1 = revstr1.substri ng(0,(revstr1.i ndexOf('.')));
// length of extension
extlen = revext.length;
extlen1 = revext1.length;
for(i=extlen;i> =0;i--)
{
// get the real extension from reversed format of ext.
ext = ext + revext.substrin g(i,i-1);
}
if(revext1!='')
{
for(i=extlen1;i >=0;i--)
{
// get the real extension from reversed format of ext.
ext1 = ext1 + revext1.substri ng(i,i-1);
}
}
FileDesc = window.parent.d ocument.getElem entById('edit[attach_desc]').value;
if((ext=='jpeg' )||(ext=='jpg') ||(ext=='gif')| |(ext=='png')|| (ext=='flv')||( ext=='mp3')||(e xt=='JPEG')||(e xt=='JPG')||(ex t=='GIF')||(ext =='PNG')||(ext= ='FLV')||(ext== 'MP3'))
{
if((ext=='jpeg' )||(ext=='jpg') ||(ext=='gif')| |(ext=='png')|| (ext=='JPEG')|| (ext=='JPG')||( ext=='GIF')||(e xt=='PNG'))
{
if(fileurl1!='' )
{
_errMsg = "Images file won't need Thumbnail" + "\n";
}
}
if(ext=='flv')
{
/*if(fileurl1==' ')
{
_errMsg = "Video file need Thumbnail image" + "\n";
}
else
{
if((ext1!='jpeg ')&&(ext1!='jpg ')&&(ext1!='gif ')&&(ext1!='png ')&&(ext1!='JPE G')&&(ext1!='JP G')&&(ext1!='GI F')&&(ext1!='PN G'))
{
_errMsg = 'Video thumbnail must be the following file types:\nImages: jpg, jpeg and gif\nVideo: flv\nAudio: MP3\n\nPlease check the media type and try again. \n\n[OK]';
}
}*/
if(fileurl1!='' )
{
if((ext1!='jpeg ')&&(ext1!='jpg ')&&(ext1!='gif ')&&(ext1!='png ')&&(ext1!='JPE G')&&(ext1!='JP G')&&(ext1!='GI F')&&(ext1!='PN G'))
{
_errMsg = 'Video thumbnail must be the following file types:\nImages: jpg, jpeg and gif\nVideo: flv\nAudio: MP3\n\nPlease check the media type and try again. \n\n[OK]';
}
}
}
if(FileDesc=='' )
{
_errMsg = 'Description is Empty...';
}
}
else
{
_errMsg = 'Media uploads must be the following file types:\nImages: jpg, jpeg and gif\nVideo: flv\nAudio: MP3\n\nPlease check the media type and try again. \n\n[OK]';
}
if(_errMsg=='')
{
//Ramesh added
var aa = parseInt(window .parent.documen t.getElementByI d('isFirstUploa d').value);
var isFirstUpload = aa + 1;
window.parent.d ocument.getElem entById('isFirs tUpload').value = isFirstUpload;
// hide old iframe
// add image progress
//var new_div = par.createEleme nt('div');
//var new_img = par.createEleme nt('img');
//new_img.src = 'indicator.gif' ;
//new_img.classNa me = 'load';
//new_div.appendC hild(new_img);
//images.appendCh ild(new_div);
// send
var imgnum = images.getEleme ntsByTagName('d iv').length - 1;
document.iform. imgnum.value = imgnum;
setTimeout("doc ument.iform.sub mit()",1000);
}
else
{
alert(_errMsg);
}
}
</script>
<form name="iform" id="iform" method="post" enctype="multip art/form-data">
<div class="form-item">
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr><td>
<p id="player"></p>
<label for="Attach file" style="font-size:13px;font-weight:bold;">F ile name (must be in jpg, jpeg, gif, mp3 or flv format)</label>
</td></tr>
<tr><td>
<input id="image0" type="file" style="width:60 0px;" name="image0" class="form-text"/><br>
</td></tr>
<tr><td>
<label for="Attach file" style="font-size:13px;font-weight:bold;">I f this file is a video (FLV format), please also upload a thumbnail image for the video.<br/> Otherwise, the first frame of the video will be used</label>
</td></tr>
<tr><td>
<input id="image1" type="file" style="width:60 0px;" name="image1" class="form-text"/>
</td></tr>
</table>
<input type="hidden" name="imgnum" />
</div>
</form>
the above code is upload.php
-----------------------------------------------------
<div id="main" name="main" style="width:85 0px; height:120px;">
<!--<label for="Attach file" class="label_ti tle_bold">Attac h new file</label>-->
<div id="iframe" name="iframe" style="width:85 0px; height:120px;ov erflow:visible; display:block">
<iframe name="attach_fr ame" id="attach_fram e" src="upload.php " style="width:85 0px; height:120px;" frameborder="0" ></iframe>
</div>
<div class="form-item" name="_Confirm_ buttons" id="_Confirm_bu ttons">
<input type="button" value="Add media" class="form-submit" onclick="attach _frame.upload() ;">
</div>
this is the area where i am adding images
plz can u help me in solving this problem
thanks
Ram