我使用Telerik radasyncupload控件,如下所示:
的Web.Config
<appSettings>
<add key="Telerik.AsyncUpload.TemporaryFolder" value="~/App_Data/RadUploadTemp" />
</appSettings>
ASP.NET
<telerik:RadAsyncUpload ID="rauIconUpload" runat="server" ChunkSize="0" Localization-Cancel="Löschen" Localization-Remove="Entfernen" Localization-Select="Auswählen"
Culture="de-DE" Skin="MetroTouch" TargetFolder="img/icons" MaxFileInputsCount="1">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="rbtnIconUpload" runat="server" Text="Speichern" Skin="MetroTouch"></telerik:RadButton>
VB.NET
Private Sub rbtnIconUpload_Click(sender As Object, e As EventArgs) Handles rbtnIconUpload.Click
If rtxtIconBezeichnung.Text = String.Empty Or rtxtIconBezeichnung.Text = Nothing Or CHKValidation(rtxtIconBezeichnung.Text) = False Then
rnfUngueltigeEingabe.Visible = True
Else
Try
For Each f As UploadedFile In rauIconUpload.UploadedFiles
Dim img As New System.Drawing.Bitmap(f.InputStream)
Dim h As Integer = img.Height
Dim w As Integer = img.Width
img.Dispose()
Dim fileName As String = f.GetName()
IconPfad = "~/img/icons/" & fileName
If w = 16 And h = 16 Then
IconSize = "16x16"
ElseIf w = 32 And h = 32 Then
IconSize = "32x32"
Else
rnfIconNichtErzeugt.Visible = True
Exit For
End If
IconErzeugt = Datenzugriff.CRTNeuesIcon(rtxtIconBezeichnung.Text, IconPfad, rcbIconGruppe.SelectedValue, IconSize)
If IconErzeugt = True Then
rnfIconErzeugt.Visible = True
Page.ClientScript.RegisterClientScriptBlock([GetType](), "CloseScript", "redirectParentPage('IconVerwaltung.aspx')", True)
Else
rnfIconNichtErzeugt.Visible = True
End If
Next
Catch ex As Exception
rnfIconNichtErzeugt.Visible = True
End Try
End If
End Sub
如果我尝试使用InputStream,我会得到一个filenotfoundexeption。我添加了一个Screanshot这个错误。
那么,有人知道我做错了吗?
感谢您的阅读。 丹尼尔
答案 0 :(得分:0)
尝试从标记中删除TargetFolder属性:
<telerik:RadAsyncUpload ID="rauIconUpload" runat="server" ChunkSize="0" Localization-Cancel="Löschen" Localization-Remove="Entfernen" Localization-Select="Auswählen"
Culture="de-DE" Skin="MetroTouch" MaxFileInputsCount="1">
</telerik:RadAsyncUpload>
并在点击按钮事件中手动保存文件。