Har gjort en sida där man kan ladda upp filer. Problemet är att när jag försöker ladda upp så får jag bara "Sidan kan inte visas". Någon som vet vad problemet kan vara?Upload-problem
<code>
Imports System.IO
Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
Dim MyPath, MyName As String
MyPath = "C:\Inetpub\wwwroot\data\prog\loin\ljud\"
MyName = Dir(MyPath, vbDirectory)
If MyName = "" Then
MkDir("C:\Inetpub\wwwroot\data\prog\loin\ljud\")
Span2.InnerHtml = "A Folder (C:\Inetpub\wwwroot\data\prog\loin\ljud\) is created at the Page_Load"
End If
End Sub
Sub Upload_Click(ByVal Sender As Object, ByVal e As EventArgs)
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.Visible = True
Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName)
Try
MyFile.PostedFile.SaveAs("C:\Inetpub\wwwroot\data\prog\loin\ljud\" + c)
Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : C:\Inetpub\wwwroot\data\prog\loin\ljud\" & c
Catch Exp As Exception
Span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.Visible = False
Span2.Visible = False
End Try
End Sub
</code>
HTML:
<code>
<Form id="Form1" Method="Post" EncType="Multipart/Form-Data" RunAt="Server">
Välj fil: <BR>
<Input ID="MyFile" Type="File" RunAt="Server" Size="40"> <BR>
<BR>
<Input id="Submit1" Type="Submit" Value="Ladda upp" OnServerclick="Upload_Click" RunAt="Server">
<P />
<Div ID="UploadDetails" Visible="False" RunAt="Server">
File Name: <Span ID="FileName" RunAt="Server"/> <BR>
File Content: <Span ID="FileContent" RunAt="Server"/>
<BR>
File Size: <Span ID="FileSize" RunAt="Server"/>bytes
<BR></Div>
<Span ID="Span1" Style="Color:Red" RunAt="Server"/>
<Span ID="Span2" Style="Color:Red" RunAt="Server"/>
</Form>
</code>