Jump to content

Correct way to write path for a folder


pete2321

Recommended Posts

I am using some free code on my website to upload images but having difficulty changing the settings.

$destination_folder		= './uploads/'; 

The above file is in /public_html/page/ and saves the pictures to /public_html/page/uploads/

 

How can I change the destination folder to /public_html/pictures/

 

I have tried a few obvious things such as '../pictures/' 

Any ideas?

Thanks,

 

Link to comment
https://forums.phpfreaks.com/topic/293694-correct-way-to-write-path-for-a-folder/
Share on other sites

If pictures is a directory in your webroot, as your example illustrates, then you can use /pictures

 

Because:

/ is the root folder (Webroot in your case)

./ is the current folder

../ is the parent folder

 

Also, if you do not put a slash, it is the same as ./

For example, pictures will load from the current directory

Thanks for that,

I have tried it and it just doesn't seem to want to work when the destination folder isn't in the same folder as the upload page script.

 

The code I'm using is from this tutorial... http://www.sanwebe.com/2012/05/ajax-image-upload-and-resize-with-jquery-and-php

Thx

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.