kieran82 Posted August 18, 2015 Share Posted August 18, 2015 I have 2 website each of them in sub folders from httpdocs on appache and I want to upload the files to the root directory on the web server and not to the root folder of the folder that the website is located. Is there a way to do this in php. Quote Link to comment https://forums.phpfreaks.com/topic/297851-upload-outside-website-root-folder/ Share on other sites More sharing options...
scootstah Posted August 18, 2015 Share Posted August 18, 2015 Yes, just specify the path. Absolute path is the best way, but you can also go upwards in the tree relative to your script. Quote Link to comment https://forums.phpfreaks.com/topic/297851-upload-outside-website-root-folder/#findComment-1519169 Share on other sites More sharing options...
ginerjm Posted August 19, 2015 Share Posted August 19, 2015 Since http file uploads go to a temporary folder on your server, your php script that is 'receiving' it for you can simply use the proper function to move the file from the temp to the final folder of your choice. Assuming that you have truly done an upload using a webpage then the simple answer is to use the function move_uploaded_file() (look it up in the manual). Quote Link to comment https://forums.phpfreaks.com/topic/297851-upload-outside-website-root-folder/#findComment-1519258 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.