简体   繁体   中英

PHP File Upload doesn't upload

Hi I'm trying to upload an image but it seems not working. And I think I have my syntax right. Can you help me out? Thanks

     $image_path    = "/uploads/" . strtolower($_FILES["profpic"]["name"]);
     //$image_path is just that I'm getting the file name so that I can get the path and save to the database

     $target_path   = 'uploads/' . basename( $_FILES['profpic']['name']); 
     move_uploaded_file($_FILES['profpic']['tmp_name'], $target_path);

Here's where it should go:

C:\\xampp\\htdocs\\noel\\uploads

试试$target_path这个绝对路径

$target_path   = $_SERVER['DOCUMENT_ROOT'].'/noel/uploads/' . basename( $_FILES['profpic']['name']); 

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