Announcement

Collapse
No announcement yet.

Drag Ereignis auslöen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Drag Ereignis auslöen

    Hallo,

    ich benutze Dropzone.js um Dateien hoch zu laden.

    Nun möchte ich aber auch Bilder aus anderen Webseiten reinziehen. Habe mir ein php geschrieben das das Bild zurück gibt.

    Nun müsste ich das drop ereignis simulieren.

    Also statt ich mit der Maus eine Datei reinziehe, muss ich das aus js machen.

    soweit bin ich, das das drop ereignis anspringt. Aber es klappt noch nicht:

    Code:
    $.ajax({
      type:"GET",
      url:"loadImage.php",
      data: {
      "imageUrl":imageUrl
                              }
                          }).done(function(data) {
      varfile = newFile([data], "filename.png");
      files = [];
      files.push(file);
        console.log(files);
      dropbox.ondrop({
      dataTransfer: {
      files: [FileListe]
                                  },
      preventDefault:function() {}
                              });
                          });
    Ich übergebe per ajax die URL an mein PHP script, das wiederum liefert das File zurück (hoffe das passt so):
    PHP Code:
      <?php    if (isset($_GET['imageUrl'])) {      $ch curl_init();        // set URL and other appropriate options      curl_setopt($ch, CURLOPT_URL, $_GET['imageUrl']);      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);      curl_setopt($ch, CURLOPT_HEADER, 0);        // grab URL and pass it to the browser      $img = curl_exec($ch);        // close cURL resource, and free up system resources      curl_close($ch);      echo $img;  }
    ich denk das das onDrop nicht vollständig ist

  • #2
    Warum nicht gleich weiße Schrift auf weißem Grund?

    Warum nicht direkt mit
    https://www.dropbox.com/developers/saver
    Dropbox.save(url, filename, options);
    Christian

    Comment

    Working...
    X