Jump to content

[SOLVED] destination directory


AceOfJames

Recommended Posts

I want this file upload script to upload a file to a directory outside of the directory that the upload script is in.

 

Where in this code would I put the path to the destination directory?

 

<?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);

?>

 

Thank you in advance!

 

AceOfJames

Link to comment
https://forums.phpfreaks.com/topic/142435-solved-destination-directory/
Share on other sites

That worked perfectly!

 

Thanks cooldude832!

 

AceOfJames

 

 

Second scope question of the night.

 

When in doubt go absolute the $_SERVER array is very useful in a lot of cases.

 

If you have a chance make a file that just has

 

<?php
print_r($_SERVER);
?>

 

and then in firefox view its source and look at all the goodies in there you will be shocked.

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.