Current time: 03-22-2010, 05:32 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(PHP) Uploading a file to the directory above your upload script?
01-05-2009, 11:49 AM
Post: #1
(PHP) Uploading a file to the directory above your upload script?
I am creating an upload manager for one of my projects and i want to upload the files to a directory in the one above the admin directory so i have been using:

PHP Code:
$target '../uploads'

But this dosn't seem to be working, is there another way?

(either that or could someone suggest how i can make a relative url of a file work form both a WYSIWYG editor in /admin and the pages in the root directory? They obviously both have to be using the same code.

[Image: y9jcmj8]
[Image: 235Ap]
My plugins & themes.
The Fun Button! For Vista Sidebar & Windows 7 desktop gadgets.
Find all posts by this user
Quote this message in a reply
01-05-2009, 12:20 PM
Post: #2
RE: (PHP) Uploading a file to the directory above your upload script?
When you make the call to move_uploaded_file, just use ".." in the path there.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2009, 01:31 PM
Post: #3
RE: (PHP) Uploading a file to the directory above your upload script?
or use
PHP Code:
$target dirname(dirname(__FILE__))."/uploads"
To get the full path. Recommended.
Find all posts by this user
Quote this message in a reply
01-05-2009, 01:45 PM
Post: #4
RE: (PHP) Uploading a file to the directory above your upload script?
Have you defined a global Document Root? This helps a lot. In a root file of your program, do this:
PHP Code:
define("DOC_ROOT"dirname(__FILE__)."/");

$target DOC_ROOT."uploads"
I use that, and it helps out a lot.

-Doug
MyBB Developer
XHTML/CSS Designer, PHP & MySQL Developer | My Twitter
Do not PM me for support or a custom theme.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: