si tenta di creare una foto..ti posto il codice completo...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'uncomment the lines 9-11 if you want to use the progress bar
'Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
'PID = "PID=" & UploadProgress.CreateProgressID()
'barref = "framebar.asp?to=10&" & PID
%>
<html>
<head>
<title>photo Album </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
<!--
function DoneNowPic(what, type) {
var filename = "";
var PicIndex = what.lastIndexOf('.', what.length - 1);
var PicFileExtension = what.substr(PicIndex + 1).toLowerCase();
if ((PicFileExtension != 'jpg') && (PicFileExtension != 'gif') && (PicFileExtension != 'jpeg') && (PicFileExtension != 'bmp') && (PicFileExtension != 'png') && (PicFileExtension != 'jpe')) {
document.images.theimage.src="images/theimage.gif"
return false;
} else {
filename = "file:///" + document.MyForm.FILE.value;
document.images.theimage.src=filename
}
}
function ShowProgress()
{
strAppVersion = navigator.appVersion;
if (document.MyForm.FILE.value != "" || document.MyForm.FILE2.value != "" || document.MyForm.FILE3.value != "")
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE') +5,1) > 4)
{
winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=370,height=115', true);
}
}
return true;
}
function MM_findObj(n, d) { //v4.01
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);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
function tmt_checkImgObj(){//v2.0
var errorMsg="";
if(this.maxS!=""&&this.fileSize/1000>this.maxS){
errorMsg+="Maximum size for images is: "+this.maxS+" kilobytes \n";}
if(this.minS!=""&&this.fileSize/1000<this.minS){
errorMsg+="Minimum size for images is: "+this.minS+" kilobytes \n";}
if(this.maxW!=""&&this.width>this.maxW){
errorMsg+="Maximum width allowed for images is: "+this.maxW+" pixels \n";}
if(this.minW!=""&&this.width<this.minW){
errorMsg+="Minimum width allowed for images is: "+this.minW+" pixels \n";}
if(this.maxH!=""&&this.height>this.maxH){
errorMsg+="Maximum height allowed for images is: "+this.maxH+" pixels \n";}
if(this.minH!=""&&this.height<this.minH){
errorMsg+="Minimum height allowed for images is: "+this.minH+" pixels \n";}
if(errorMsg==""){
if(this.fW){var fW=MM_findObj(this.fW);if(fW){fW.value=this.width; }}
if(this.fH){var fH=MM_findObj(this.fH);if(fH){fH.value=this.height ;}}}
else{alert(errorMsg);}document.MM_returnValue=(err orMsg=="");
}
function tmt_createImgObj(imgURL,loadHandler,minW,maxW,minH ,maxH,minS,maxS,fW,fH){//v2.0
document.MM_returnValue=false; var img=new Image();img.minW=minW;img.maxW=maxW;img.minH=minH; img.maxH=maxH;
img.fW=fW;img.fH=fH;img.minS=minS;img.maxS=maxS;im g.onload=loadHandler;img.src=imgURL;
}
function tmt_CheckImg(formElement,minW,maxW,minH,maxH,minS, maxS,mime,fW,fH){//v2.0
document.MM_returnValue=true;if(document.getElemen tById){var obj=MM_findObj(formElement);
var f=obj.form.name;if(obj&&f){var imgRex=new RegExp("\\.("+mime+")$","i");if(imgRex.test(obj.va lue)){
var imgURL="file:///"+obj.value;tmt_createImgObj(imgURL,tmt_checkImgOb j,minW,maxW,minH,maxH,minS,maxS,fW,fH);
eval("setTimeout(\"if(document.MM_returnValue){doc ument."+f+".submit()}\",300)");}
else{document.MM_returnValue=false;alert("Either File field is empty or you are trying to upload file type other than "+mime+" ");obj.focus();obj.select();}}}
}
//-->
</SCRIPT>
<link href="assets/style_sheets/css.css" rel="stylesheet" type="text/css">
<link href="../style/saturnowebstyle.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="10" scroll="no">
<FORM ACTION="photo_upload_post.asp" METHOD="POST" ENCTYPE="multipart/form-data" name="MyForm" id="MyForm" >
<table width="120" height="120" border="0" align="center" class="cellover">
<tr>
<td bordercolor="#999999"><div align="center">[img]assets/images/theimage.gif[/img]</div>
</td>
</tr>
</table>
<table border="0" align="center" class="sfondocentro">
<tr>
<td colspan="2"><div align="center">
<table width="99%" border="1" bordercolor="#666666">
<tr>
<td bordercolor="#CCCCCC"><div align="center" class="sfondosinistraAlto"><font color="#FFFFFF">Now
you can upload <font color="#FF0000">JPEG, GIF, BMP and PNG
files</font>
with the following dimensions can be uploaded:
Min. Width:180 px, Min. Height: 180 px
Max. Width: 800px, Max. Height: 800 px</font></div></td>
</tr>
</table>
</div></td>
</tr>
<tr class="SuScuro">
<td width="104">
<div align="right"><font color="#FFFFFF">Image Title:</font></div></td>
<td width="239" bordercolor="#666666">
<input name="title" type="text" class="Fields" id="title2" onBlur="MM_validateForm('title2','','R');return document.MM_returnValue" value="Title Please??" size="35">
</td>
</tr>
<tr class="SuScuro">
<td>
<div align="right"><font color="#FFFFFF">Image Description:</font></div></td>
<td bordercolor="#666666">
<TEXTAREA NAME="DESCR" cols="35" rows="4" class="Fields" onBlur="MM_validateForm('DESCR','','R');return document.MM_returnValue">Please Write Description</TEXTAREA>
</td>
</tr>
<tr class="SuScuro">
<td colspan="2">
<div align="center">
<INPUT NAME="FILE" TYPE="FILE" class="cellover" id="FILE3" SIZE="40" onChange="DoneNowPic(this.value, false)">
</div></td>
</tr>
<tr class="SuScuro">
<td colspan="2">
<div align="center"><font color="#FFFFFF">Check
if you want the picture to be private</font>
<input name="radio" type="radio" class="Buttons" value="1">
</div></td>
</tr>
<tr class="SuScuro">
<td colspan="2">
<div align="center">
<INPUT name="SUBMIT" TYPE="button" class="cellover" onClick="tmt_CheckImg('FILE3','100','1500','100',' 1500','10','800','jpg|jpeg|gif|png|bmp|jpe','width ','height');return document.MM_returnValue" VALUE="Upload!" >
</div></td>
</tr>
</table>
<input name="height" type="hidden" id="height">
<input name="width" type="hidden" id="width">
</FORM>
</body>
</html>

Rispondi quotando