Forums
This topic is locked
asp.net upload dont work
Posted 07 Jan 2003 17:13:05
1
has voted
07 Jan 2003 17:13:05 paul durbar posted:
Appologies for cross posting, stuck this in the Ultradev forum originally but then thought it doesnt support .net so i'm posting it here insteadCant get the asp.net upload extension working at all, tried everything, the following code produces the error:
Compiler Error Message: BC30451: Name 'file' is not declared.
Source Error:
Line 14: >
Line 15: <Parameters>
Line 16: <Parameter Name="@drawingfilename" Value='<%# IIf((file.PostedFile.FileName <> Nothing), GetFileNameFromPath(file.PostedFile.FileName), ""

Line 17: </MMnsert>
Line 18: <MM

Source File: C:\Inetpub\wwwroot\aspxupload\TMPc7mu88cp1e.aspx Line: 16
The page code is:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MMnsert
runat="server"
CommandText='<%# "INSERT INTO uploads (drawingfilename) VALUES (?)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_uploadconn"

DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_uploadconn"

Expression='<%# Request.Form("MM_insert"

CreateDataSet="false"
SuccessURL='<%# "uploaddone.aspx" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@drawingfilename" Value='<%# IIf((file.PostedFile.FileName <> Nothing), GetFileNameFromPath(file.PostedFile.FileName), ""

</MMnsert>
<MM

id="DataSet1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_uploadconn"

DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_uploadconn"

CommandText='<%# "SELECT * FROM uploads" %>'
Debug="true"
></MM

<MMageBind runat="server" PostBackBind="true" />
<script language="vb" runat="server">
' ===============================================================================
' WWWeb Concepts ASP.NET Development Solutions www.ebconcepts.com
' Copyright 2002. All Rights Reserved. Get file from form1
' ===============================================================================
Function GetFileNameFromPath(ByVal PathName As String)
Dim intFirstPos As Integer
intFirstPos=InStrRev(PathName, "\"

GetFileNameFromPath = Mid(PathName, intFirstPos)
End Function
Sub Page_UnLoad(Source As Object, E As EventArgs)
If Page.IsPostBack then
Dim strSavePath As String
Dim strFileName As String
strFileName=GetFileNameFromPath(file.PostedFile.FileName)
strSavePath =Server.MapPath("uploads"

If(file.PostedFile.FileName <> Nothing) then
file.PostedFile.SaveAs(strSavePath & "\" & strFileName)
end if
end if
End Sub
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; ch****t=iso-8859-1">
</head>
<body>
<form runat="server" action="" method="post" enctype="multipart/form-data" name="form1">
<p>
<input type="file" name="file">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
Anyone any ideas, im stuck here????
Replies
Replied 09 Jan 2003 01:04:17
09 Jan 2003 01:04:17 paul durbar replied:
Sorted it, it appears that Dreamweaver has bizarrely chopped some of the code leading to a syntax error, check out lines like:
<MMnsert
runat="server"
This should read as:
<MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
similarly:
<MMageBind runat="server" PostBackBind="true" />
should be: <MM<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ageBind
Bizarre! Seems to be working fine now though.
<MMnsert
runat="server"
This should read as:
<MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
similarly:
<MMageBind runat="server" PostBackBind="true" />
should be: <MM<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>ageBind
Bizarre! Seems to be working fine now though.
Replied 09 Jan 2003 01:08:14
09 Jan 2003 01:08:14 paul durbar replied:
Oh............
I didnt mean to do the faces
for the faces read:
: I
and
: P
I didnt mean to do the faces
for the faces read:
: I
and
: P