Hi folks,
I found this code years ago and recently dug it up for a script I was working on. It appears to work nicely still on IE7 and FF locally but when uploaded to the server it stops functioning - stone dead.
Could someone with more knoledge than myself have a look and tell me where I am going wrong?
Many thanks,
Rikki
PS: I've cut the code down to just the most basic elements so excuse the crudeness.
Code:<html> <head> <title></title> </head> <script type="text/javascript"> xximage1 = new Image(); xximage1.src = "image_uploading.gif"; function MM_findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for (i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; } function change_photo() { var ofile; var validFile=0; ofile = MM_findObj('contact').fileimage.value; if (ofile!='') { var stringLength=ofile.length; var stringDetect=ofile.substring((stringLength-4),stringLength); stringDetect=stringDetect.toLowerCase(); if (stringDetect=='.jpg' || stringDetect=='.gif' ) {validFile=1} } if (validFile==1) { MM_findObj('previewimage').src = ofile } else { MM_findObj('previewimage').src = "image_notselected.gif"; } } </script> <CENTER> Template System<P> <TABLE WIDTH=800 CELLPADDING=5 CELLSPACING=5 BORDER=1 BORDERCOLOR=BLACK> <FORM name="contact" method="post" action="ebaysave.php" enctype="multipart/form-data"> <TR><TD>Product: </TD><TD> <INPUT NAME="product" type="text" size="80" maxlength="800"></TD></TR> <TR><TD>Photo: </TD><TD> <input type="file" name="fileimage" size="8" class="inputbox2" onpropertychange="change_photo();" onFocus="change_photo();" id="r1"></TD></TR> <TR><TD>Desc:<BR><BR><CENTER> <img src="selectimage.gif" name="previewimage" border="1" width="128" height="96"> </TD></TR> <TR><TD><input type="Submit" value="Create Code"> </TD></TR> </TABLE> </form> </body> </html>




Bookmarks