move_uploaded_file Directory Help - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

move_uploaded_file Directory Help

mailedfistmailedfist Posts: 5Member
Hi I am using move_uploaded_file() to store a picture on my server but I am having problems getting the file to be stored in the correct directory. I want the file to be saved in a folder called 'pics' which is in the same directory as the .php file but it is always stored in the same directory as my .php file. Here is my code...

$updir = "pics/";
$upDir .= $_FILES['userfile']['name'];
$upDir = rawurlencode($upDir);

move_uploaded_file($_FILES['userfile']['tmp_name'], $upDir);

I've tried changing the line
$upDir = "pics/";
To many different thing but I always end up with the file saved in the parent directory of the pics folder (the parent directory of pics holds the .php file).

What am I missing? Thanks!


Comments

Sign In or Register to comment.