S
S
Sergey Defactov2017-04-04 01:22:37
WYSIWYG
Sergey Defactov, 2017-04-04 01:22:37

Loading images in imperavi?

The documentation provides an example
<?php
// This is a simplified example, which doesn't cover security of uploaded images.
// This example just demonstrate the logic behind the process.
// files storage folder
$dir = '/sitecom/images/';
$_FILES['file']['type'] = strtolower($_FILES['file']['type']);
if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file' ]['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg'
) {
// setting file's mysterious name
$filename = md5(date('YmdHis')).'.jpg';
$file = $dir.$filename;
// copying
move_uploaded_file($_FILES['file']['tmp_name'], $file);
// displaying file
$array = array(
'url' => 'images/'.$filename,
'id' => 123
);
echo stripslashes(json_encode($array));
}
?>
Prescribed folders but does not load images, ps help a beginner how to organize the upload of images in imperavi
Here is what the network console says
Warning: copy(/home/mab/public_html/upload/2ba4009a03031dd9ee2c989022cad978.jpg): failed to open stream: Permission denied in /home/mab/public_html/image_upload.php on line 23
{"filelink":"/upload/2ba4009a03031dd9ee2c989022cad978.jpg"}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question