jsk
jsk

Reputation: 337

PHP:Uploading to wrong folder. How to change it to get it in to right place?

I want to Upload picture to my web server.

$newname = dirname(__FILE__).'/upload/'.$filename;

The code above would add my picture to folder like this:

www.something.com/admin/upload

How could I get my file to the correct folder:

www.something.com/upload

As you see, it should go one forder back.

The complety code is found on:

http://www.webcheatsheet.com/PHP/file_upload.php

Upvotes: 2

Views: 89

Answers (1)

reko_t
reko_t

Reputation: 56430

$newname = realpath(dirname(__FILE__).'/../upload').'/'.$filename;

Upvotes: 5

Related Questions