Jump to content

Correct way to write path for a folder


Go to solution Solved by Zane,

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

  • Solution

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.