简体   繁体   中英

My php program is not moving uploaded image on my raspberry pi directory

Hi I'm having a hard time figuring out how to upload my image on my raspberry pi directory. I tried the code below but it returns a blank array. Here's my code 这是我的代码

HTML:

<form action="upload.php" class="dropzone text-center" id="left-drop"> </form>

PHP:

<?php
$target_dir = "/var/www/html/image/main";
$target_file = $target_dir . basename($_FILES["image"]["tmp_name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));


if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "error\n";
}
?>

My raspberry pi permissions:

My folder permissions 在此处输入图片说明 Thank you.

I initially assumed that you knew the code you were writing allowed anyone to pwn your server, however you

  • present your permissions in a screen shot of the LXDE file manager
  • write code with no error checking or reporting
  • provide no explanation what did happen and why it did not meet your expectations
  • have not checked your log files for any errors
  • did not provide a MCVE

makes me suspect this is not the case. (some hints above about how to start solving the problems)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM