Help with upload component

cramerhwood

New member
Joined
Sep 11, 2007
Messages
1
Programming Experience
Beginner
I am working on this upload for a file browser in .net. It works, but I want be able to upload to the current directory I'm browsing and not just the same upload directory. I'm using this code to upload:

VB.NET:
<%@ Page language="vb" ContentType="text/plain" debug="true" %>
<script language="vb" runat="Server">
Dim uploadFolder As String = "GetCurDir()"
Sub Page_Load()
If Not (IsPostBack) Then
Try
Dim uploads As HttpFileCollection
uploads = Request.Files
Dim postedFile As HttpPostedFile
Dim savePath As string
savePath = Server.MapPath(uploadFolder)
Dim filename As String
Dim x As Integer
Dim pos As Integer
For x = 0 to (uploads.Count - 1)
postedFile = uploads(x)
pos = postedFile.FileName.LastIndexOf("\")
If (pos > 0) Then
filename = postedFile.FileName.Substring(pos + 1)
Else
filename = postedFile.FileName
End If
postedFile.SaveAs(savePath + "\temp\" + filename)
Next x
Catch ex As Exception
' Handle exception
End Try
End If
End Sub
</script>

The rest of the the application uses "lbl_BreadCrumb" to display current directory and is defined in an aspx.vb file as
VB.NET:
lbl_BreadCrumb.Text = GetCurDir()
I am very new to this and am probably over my head, but any help would be greatly appreciated.
 
Back
Top