Jump to content

uploading file location


tomdelonge

Recommended Posts

When i use this script to process my form, the file is uploaded to the same directory as this file. I want it to go to a directory below it, in a folder called "uploads". Where do I put that? I would guess the $destination_path variable needs it somewhere in there, but I'm doing something wrong. It doesn't work.

<?php
   // Edit upload location here
   $destination_path = getcwd().DIRECTORY_SEPARATOR;

   $result = 0;
   
   $target_path = $destination_path . basename( $_FILES['myfile']['name']);

   if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
      $result = 1;
   }
   
   sleep(1);
?>

Link to comment
https://forums.phpfreaks.com/topic/137592-uploading-file-location/
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.