tuto jour 6

Par PKR, il y a 7 ans


Bonjour,

Voila je rencontre un petit problème avec mon code.

Ce que je fais

Décrivez ici votre code ou ce que vous cherchez à faire

<table> <div class="Label anything"> <thead> <tr><th></th> <th>Titre</th> <th>Actions</th> </tr> </thead> </div> <tbody> <?php foreach ($images as $k => $v):?> <tr> <td> <a href="#" onClick="FileBrowserDialogue.sendURL('<?php echo Router::webroot('img/'.$v->file); ?>')"> <img src="<?php echo Router::webroot('img/'.$v->file); ?>" height="100"> </a> </td> <td><?php echo $v->name; ?></td> <td> <a onclick="return confirm('Voulez vous vraiment suprimer cette image');"href="<?php echo Router::url('admin/posts/delete/'.$v->id); ?>">Suprimer</a> </td> </tr> <?php endforeach; ?> </tbody> </table> <div class="page-header"> <h1>Ajouter une image</h1> </div> <form action="<?php echo Router::url('admin/medias/index/'.$post_id); ?>" method="post" enctype="multipart/form-data"> <?php echo $this->Form->input('file','Image',array('type'=>'file')); ?> <?php echo $this->Form->input('name','Titre'); ?> <div class="actions"> <input type="submit" name="" value="Envoyer" class="btn btn primary"> </div> </form> <script type="text/javascript" src="<?php echo Router::webroot('js/tinymce/tiny_mce_popup.js'); ?>"></script> <script type="text/javascript"> var FileBrowserDialogue = { init : function () { // Here goes your code for setting your custom things onLoad. }, sendURL : function (URL) { //var URL = document.my_form.my_field.value; var win = tinyMCEPopup.getWindowArg("window"); // insert information now win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL; // are we an image browser if (typeof(win.ImageDialog) != "undefined") { if (win.ImageDialog.getImageData) win.ImageDialog.getImageData(); // we are, so update image dimensions and preview if necessary if(win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(URL); } // close popup window tinyMCEPopup.close(); } } tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue); </script>

Ce que je veux

Uploade l'Image

Ce que j'obtiens

Uncaught TypeError: Cannot read property 'document' of undefined comme message d'erreur sur chrome en console

Aucune réponse