Jump to content

Upload File Path not changing??


Drewser33

Recommended Posts

Here is the code I am using.  As mentioned below the mkdir is working well but when I change the path to save to it does not go to that directory but adds the task to the filename instead of the path??  Any ideas?

 

$task = $_GET['taskid'];

$employeeid = $_GET['employeeid'];

 

mkdir("uploads/$task");  //Working perfectly, creates the directory for each task under the folder uploads.

 

$target_path = "uploads/$task";  //Not working, does not save the file inside this directory but adds the task to the file name.

 

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {

 

    $filename =  basename( $_FILES['uploadedfile']['name']);

 

    $query = "INSERT INTO tbluploads (taskid,filename) VALUES ('$task','/csPortal/task/uploads/$filename')";

    mysql_query($query) or die(mysql_error());

    ?>

    <tr>

    <td>

<button onClick="window.location='taskhome.php?name=<?php echo $employeeid; ?>'">Continue</button>

</td>

</tr>

<?php

} else{

    echo "There was an error uploading the file, please try again!";

}

 

 

THANKS for all the help

Link to comment
https://forums.phpfreaks.com/topic/93521-upload-file-path-not-changing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.