Problemer med aspsmartupload
HejJeg er løbet ind i et problem der giver mig grå hår i hovedet ;-)
jeg har den her kode
kodeeksempel...
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/CharonCart.asp" -->
<!--#include file="Access.asp" -->
<%
ProductID=Request.QueryString("ProductID")
%>
<%
Dim ProductsRS__param
ProductsRS__param = "0"
If (ProductID <> "") Then
ProductsRS__param = ProductID
End If
%>
<%
Dim ProductsRS
Dim ProductsRS_numRows
Set ProductsRS = Server.CreateObject("ADODB.Recordset")
ProductsRS.ActiveConnection = MM_CharonCart_STRING
ProductsRS.Source = "SELECT * FROM Products WHERE ProductID=" + Replace(ProductsRS__param, "'", "''") + ""
ProductsRS.CursorType = 0
ProductsRS.CursorLocation = 2
ProductsRS.LockType = 3
ProductsRS.Open()
ProductsRS_numRows = 0
%>
<%
Dim mySmartUpload
Dim intCount
if AccessGroupID <> 2 then
if Request.QueryString("upload") <> "" then
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.AllowedFilesList = "GIF,JPG,JPEG,BMP,PNG"
mySmartUpload.DeniedFilesList = "exe,bat,asp"
mySmartUpload.Upload
Set File = mySmartUpload.Files("file")
UserFilename=File.FileName
ProductsRS("Image")=UserFilename
ProductsRS.Update
File.SaveAs Server.MapPath("../images/" & UserFilename)
Response.Redirect("closewindowpage.asp")
end if
end if
%> <html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function getFileExtension(filePath) { //v1.0
fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}
function checkFileUpload(form,extensions) { //v1.0
document.MM_returnValue = true;
if (extensions && extensions != '') {
for (var i = 0; i<form.elements.length; i++) {
field = form.elements[i];
if (field.type.toUpperCase() != 'FILE') continue;
if (field.value == '') {
alert('Browse et billede !');
document.MM_returnValue = false;field.focus();break;
}
} }
}
//-->
</script>
<link rel="stylesheet" href="STYLES.CSS" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<form name="form1" method="post" action="product_image.asp?upload=true&ProductID=<%=ProductID%>" enctype="multipart/form-data" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG');return document.MM_returnValue">
<table border="0" width="95%" align="center" cellpadding="4" cellspacing="1">
<tr>
<td align="center" bgcolor="#006699"><strong><font color="#FFFFFF">Opload
billede</font></strong></td>
</tr>
<tr>
<td bgcolor="EEEEEE"><input name="file" type="file" size="35"> </td>
</tr>
<tr>
<td bgcolor="EEEEEE"><input type="submit" name="submit" value="Opload"> </td>
</tr>
<tr>
<td bgcolor="EEEEEE"></td>
</tr>
</table>
</form>
</body>
</html>
<%
ProductsRS.Close()
Set ProductsRS = Nothing
%>
Problemet er 2 ting.
Den ene er at billedet ikke bliver omdåbt til feks. "taske1S.jpg"
og det andet er at jeg ikke kan styre størrelsen. Det skal være 2 størrelser. Nu er det bare den samme som selvet billedet har før upload.
Hvordan klare jeg den??
