|
wizard_oz -> RE: upload many files to DataBase (8/3/2005 14:51:55)
|
I am using the code that spooky gave upload.zip and the code look like<!--#include file="code/clsupload.asp"-->
<%
'#===========================
'# Allowable file extensions
'#===========================
sAllowedFiles = "zip,jpg,gif"
'#===========================
'# Upload size max in bytes
'#===========================
iUplSize = 200000
'#===========================
'# File path (based on the root of your web)
'#===========================
sUploadPath = "/uploads"
'#===========================
'# Name of the text box that the
'# file name will be saved to.
'#===========================
TextBox = "Upload"
Set Upload = New clsUpload
FileName = Upload.Fields("FileName").FileName
Ext = Upload("FileName").FileExt
if inStr(uCase(sAllowedFiles),uCase(Ext)) > 0 then
If Upload("FileName").Length <= iUplSize then
Folder = Server.MapPath(sUploadPath) & "\"
FileName = Upload.UniqueName(Folder, FileName)
Upload("FileName").SaveAs Folder & FileName
Else
errmessage = "File must be less than "& iUplSize/1000 & " kb"
End if
else
errmessage = "File type not supported."
end if
Set Upload = Nothing
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function copyForm() {
opener.document.Upload.<%=TextBox%>.value = document.popupForm.FileName.value;
document.popupForm.submit();
window.close();
return false;
}
//-->
</SCRIPT>
</HEAD>
<%If len(errmessage) > 0 then%>
<BODY>
<%=errmessage%>
<%Else%>
<BODY onLoad="return copyForm()">
<FORM NAME="popupForm" onSubmit="return copyForm()">
<INPUT TYPE="TEXT" NAME="FileName" value="<%=FileName%>">
<INPUT TYPE="BUTTON" VALUE="Submit" onClick="copyForm()">
</FORM>
<%end if%>
</BODY>
</HTML>
|
|
|
|