0

我像这样使用 Telerik radasyncupload 控件:

网络配置

<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。我添加了这个错误的截图。

那么,有人知道我做错了什么吗?

感谢您的阅读。丹尼尔

文件未找到

4

1 回答 1

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>

并在单击按钮事件中手动保存文件。

于 2014-07-17T11:28:53.300 回答