Jump to content


Photo

upload file to location outside of webroot?


  • Please log in to reply
4 replies to this topic

#1 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 27 July 2006 - 09:17 PM

Is it possible to use a form to upload a file to a location outside the webroot folder? I've been able to do it anywhere within the webroot.

#2 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 27 July 2006 - 09:33 PM

I should note that this PHP server is installed on a Windows-based IIS server.

#3 phil.t

phil.t
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 28 July 2006 - 03:03 AM

Try using a virtual directory.  This description assumes you have Administrative priviledges over the server in question.

In the IIS manager right click the name of your site, and select New-->Virtual Directory.  This will take you through a series of dialogs where you select an alias, and the physical location of the directory (this could be anywhere).  In your PHP code just use the alias as your target directory.

You will want to pay careful attention to your NTFS and IIS permissions for the physical directory.  IUSR will need write permissions to copy the file, though if this is implemented carelessly it could pose a security risk.

I recommend the above approach, but I've also accomplished this by using the absolute path to the directory (i.e. D:\uploads\).

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 28 July 2006 - 03:18 AM

\\uploads\\
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 phil.t

phil.t
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 28 July 2006 - 03:39 AM

oh, and it's always a good idea to escape your \'s.  Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users