Bonjour a vous!
J'aimerais savoir s'il est possible d'associer ce code à un code de formulaire d'envoie de fichier en PHP ?
Voici tout le code source qui fonctionne en ASP :
HTML :
Code :
<html>
<body>
<script language="javascript">
<!--
function DoUpload() {
theFeats = "height=120,width=500,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no";
theUniqueID = (new Date()).getTime() % 1000000000;
window.open("progressbar.asp?ID=" + theUniqueID, theUniqueID, theFeats);
document.myform.action = "progressupload.asp?ID=" + theUniqueID;
document.myform.submit();
}
//-->
</script>
<form name="myform" method="post" action="progressupload.asp" enctype="multipart/form-data">
<input type="file" name="filefield1"><br>
<input type="button" name="dosubmit" value="Upload" OnClick="DoUpload()"><br>
</form>
</body>
</html>
ASP progressupload:
Code :
<%
Response.Expires = -10000
Server.ScriptTimeOut = 300
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.Overwrite = True
theForm.MaxUploadSize = 8000000
theForm.ID = Request.QueryString("ID")
Set theField = theForm.Files("filefield1")
If theField.FileExists Then
theField.Save theField.FileName
End If
%>
<html>
<body>
Upload Complete...
</body>
</html>
ASP progressbar.php :
Code :
<%@EnableSessionState=False%>
<html>
<head>
<title>Progress...</title>
<meta http-equiv="expires" content="Tue, 01 Jan 1981 01:00:00 GMT">
<meta http-equiv=refresh content="2,progressbar.asp?ID=<%=Request.QueryString("ID")%>">
<%
On Error Resume Next
Set theProgress = Server.CreateObject("ABCUpload4.XProgress")
theProgress.ID = Request.QueryString("ID")
%>
<script language="javascript">
<!--
if (<% =theProgress.PercentDone %> == 100) top.close();
//-->
</script>
</head>
<body bgcolor="#CCCCCC">
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Uploading:</b></font></td>
</tr>
<tr bgcolor="#999999">
<td>
<table border="0" width="<%=theProgress.PercentDone%>%" cellspacing="1" bgcolor="#0033FF">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%">
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Estimated time left:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<%=Int(theProgress.SecondsLeft / 60)%> min
<%=theProgress.SecondsLeft Mod 60%> secs
(<%=Round(theProgress.BytesDone / 1024, 1)%> KB of
<%=Round(theProgress.BytesTotal / 1024, 1)%> KB uploaded)</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
Transfer Rate:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<%=Round(theProgress.BytesPerSecond/1024, 1)%> KB/sec</font></td>
</tr>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">Information:</font></td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><%=theProgress.Note%></font></td>
</tr>
</table>
</td>
</tr>
<tr></tr>
</table>
</body>
</html>
J'espere que quelqu'un pourra traduire ceci !
Merci