1

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

1 Answer 1

1

try this absolute path in $target_path

$target_path   = $_SERVER['DOCUMENT_ROOT'].'/noel/uploads/' . basename( $_FILES['profpic']['name']); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.