A
A
artekha2016-11-23 23:36:05
css
artekha, 2016-11-23 23:36:05

How to configure atom?

There are two questions:
1) In the sublime, you could hold down cmd + option and select the desired area with the mouse (this is not the same as just holding cmd), but in atom you can only hold cmd.
2) When I write jade code, by pressing enter (line feed) after the .block block, the next line adds another tab, as if I were going to make nested elements for .block. How to remove it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2017-03-08
@Klapanasos

Make the form of type multipart form data.
Change the input name to photo[] , this is necessary both when using multiple (HTML5) and with this option with several inputs, in these two cases the request sent is no different, except that empty fields will also come with your option and the size of the $ array _FILESwill remain unchanged, which is convenient if you need to edit the entity using the same form, so that you can then go to the page and delete part of the photo or replace it.
As for processing $ _FILES, there is no ready-made code at hand, I did it on Yii2, figure it out for yourself.

A
Alexander, 2017-03-08
@Klapanasos

$dir = '../public/images/product/';
$min_dir = '../public/images/product/thumbnails/';

if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_FILES['photo'])) {
    $photo = $_FILES['photo']['name'];
    for ($i = 0; $i < count($photo); $i++){
        $new_name_big = rand(0,9999999) . '_' . $photo[$i];
        $new_name_min = 'min_' . $new_name_big;
        $movefile = move_uploaded_file($_FILES['photo']['tmp_name'][$i], $dir . $new_name_big);
    if ($movefile){
        $resize = img_resize($dir . $new_name_big, $min_dir . 'min_' . $new_name_big, 200, 200);
        //$sql = mysqli_query($conn, "INSERT INTO photos (big_url, small_url) VALUES ('$new_name_big', '$new_name_min')");
        //mysqli_close($conn);
        echo "<p style='color:green;'>Файл загружен!</p>";
    } else {
        echo "<p style='color:green;'>Ошибка загрузки!</p>";
    };
    //exit("<meta http-equiv='refresh' content='0; url = $_SERVER[PHP_SELF]' charset=utf-8>");
   }
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question