Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hochgeladenes Bild direkt im Browser anzeigen

Empfohlene Antworten

Veröffentlicht

Wenn en bild hochgeladen wird, soll es dem Nutzer direkt im Browser angezeigt werden, wei bewerkstellige ich das am besten??

Ich mein das würd irgendwie so funktionieren:

Upload.PostedFile.InputStream

Bin mir da aber nicht so ganz sicher =)

grüße Horstiii

das muss doch irgendjemand wissen!!!

HILFEEE

Also, stressen lässt sich wohl kaum jemand gerne. ;)

Zudem wundert's mich bei der Problembeschreibung absolut nicht.

WOBEI brauchst du denn Hilfe?

Ich komm halt nicht mehr drauf, wie ein Bild welches ich mit hilfe einer upload funktion hochgeladen abe direkt im browerfenster angezeigt wird.

Um das Bild auf der Festplatte zu speichern benutze ich:

Upload.PostedFile.SaveAs(hier pfad eingeben);

nur wie kann ich anstatt das bild auf der festapltte zu speichern, das bild direkt im browser anzeigen lassen??

da komm ich nicht weiter

Ein Blick in die MSDN hilft: FileUpload.PostedFile-Eigenschaft (System.Web.UI.WebControls)


      Sub DisplayFileContents(ByVal file As HttpPostedFile)


            Dim myStream As System.IO.Stream

            Dim fileLen As Integer

            Dim displayString As String

            Dim loop1 As Integer


            ' Get the length of the file.

            fileLen = FileUpload1.PostedFile.ContentLength


            ' Display the length of the file in a label.

            LengthLabel.Text = "The length of the file is " _

                               + fileLen.ToString + " bytes."


            ' Create a byte array to hold the contents of the file.

            Dim Input(fileLen) As Byte


            ' Initialize the stream to read the uploaded file.

            myStream = FileUpload1.FileContent


            ' Read the file into the byte array.

            myStream.Read(Input, 0, fileLen)


            ' Copy the byte array to a string.

            For Loop1 = 0 To fileLen - 1

                displayString = displayString & Input(loop1).ToString()

            Next Loop1


            ' Display the contents of the file in a 

            ' textbox on the page.

            ContentsLabel.Text = "The contents of the file as bytes:"


            Dim ContentsTextBox As New TextBox

            ContentsTextBox.TextMode = TextBoxMode.MultiLine

            ContentsTextBox.Height = Unit.Pixel(300)

            ContentsTextBox.Width = Unit.Pixel(400)

            ContentsTextBox.Text = displayString


            ' Add the textbox to the Controls collection

            ' of the Placeholder control.

            PlaceHolder1.Controls.Add(ContentsTextBox)


        End Sub


Aufruf:

' Call a helper routine to display the contents

' of the file to upload.

DisplayFileContents(FileUpload1.PostedFile)

Solltest dann entsprechend den Inhalt / Stream in einer PictureBox ausgeben, anstatt wie im Beispiel einer Textbox.

So long,

wos

Ich komm damit nicht zurecht=(

kann mir jemand villeicht ein code beispiel geben, am besten in c#?!?!

Gute Idee, aber die Datei heißt doch jedesmal anders.

Wie soll ich das denn dem IMG Tag beibringen?

ja funktioniert nicht war doch klar oder -.-

wie gesagt die datei heißt jedesmal anders und wie soll das der IMG Tag können?

original.Save(Response.OutputStream, ImageFormat.Jpeg);

so klappts, nur wie mache ich das das bild in einer image box angezeigt wird, denn so stehn da nur fragezeichen und so.

Oben hab ich mich vertan =)

war doch nur save

original is ein bitmap^^

achja, im ie7 funzt das, nur im ff nich =(

muss nurnoch wissen, wie ich das in eine picturebox reinbekommen ;)

hilfe

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.