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.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe einen Durchsuchen-Dialog.


<input name="upload" type="file" size="40" accept="image/*"/>

und will nun, wenn man sich ein neues Bild ausgesucht hat, dass das Bild in einem
<img src="" alt="" class="photoUpload"/>

angezeigt wird!

sprich: nach dem Auswählen -> Anzeige in einem Image-Tag.

Gruß

Hallo,

ich habs jetzt so:


<input name="uploadFile" type="file" size="40" accept="image/*" onChange="showUploadImage()" id="uploadDialog"/>


function showUploadImage(){

  alert("blabla");


  var imageToUpload = document.getElementById("uploadPhoto");

  alert(imageToUpload);


  imageToUpload.src = "/home/afrey/Dokumente/taube.jpg";

  imageToUpload.height = "300";

  imageToUpload.width = "300";


}


<img src="leer" alt="" class="photoUpload" id="uploadPhoto"/>

das src-attribut und die height und width werden sofort gesetzt,

das bild erscheint aber nicht im imagetag.

geht das überhaupt oder brauch ich da ajax?

edit: will ja vom client in den browser, also kein ajax

Gruß

Bearbeitet von alexC++

hm... ich will ja das file vom client direkt nach der auswahl anzeigen, hat also mit dem server nichts zu tun!

ein refresh auf das image-tag mit neuer resource

geht das?

Die seite liegt auf einem server!

also funktioniert so was garnicht!?

man kann also nur ein bild auswählen und hochladen ohne es vorher irgendwie gesehen zu haben....

da muss es doch was geben....

wie "reload browser" oder sowas

besser wie "reload image tag"

Bearbeitet von alexC++

ich mein man sieht das bild nur im durchsuchen-dialog....

Was Du vorhast setzt vorraus, dass ein Script aus der Webseite heraus Zugriff auf die lokale Festplatte des Nutzers erlangen kann. Das wäre ein Super-GAU für die Sicherheit eines jeden Rechners, wäre dieses möglich.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.