-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupload.php
31 lines (30 loc) · 1.05 KB
/
upload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
if (isset($_FILES["image"]) && is_uploaded_file($_FILES["image"]["tmp_name"])) {
//@todo Change base_dir!
$base_dir = 'C:/wamp/www/kjps/www';
//@todo Change image location and naming (if needed)
$image = '/images/' . $_FILES["image"]["name"];
move_uploaded_file($_FILES["image"]["tmp_name"], $base_dir . $image);
?>
<input type="text" id="src" name="src" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script>
var ImageDialog = {
init : function(ed) {
ed.execCommand('mceInsertContent', false,
tinyMCEPopup.editor.dom.createHTML('img', {
src : '<?php echo $image; ?>'
})
);
tinyMCEPopup.editor.execCommand('mceRepaint');
tinyMCEPopup.editor.focus();
tinyMCEPopup.close();
}
};
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
</script>
<?php } else {?>
<form name="iform" action="" method="post" enctype="multipart/form-data">
<input id="file" accept="image/*" type="file" name="image" onchange="this.parentElement.submit()" />
</form>
<?php }?>