Jump to content

webroot and directory problem in php


seasexsun

Recommended Posts

If I had a website structured like this ---> http://www.domain.com and the directory was "image-gallery" and I wanted to have the images save to the folder on my domain under the directory "image-gallery", how would I change the webroot as shown in this script below, and would I add ../ to the script or just ./?  Thanks if anyone can help me.  I'm new at this, and this is from a tutorial...

 

<?php

session_start();

 

// db properties

$dbhost = 'localhost';

$dbuser = 'root';

$dbpass = '';   

$dbname = 'gallery';

 

// an album can have an image used as thumbnail

// we save the album image here

define('ALBUM_IMG_DIR', 'C:/webroot/gallery/images/album/');

 

// all images inside an album are stored here

define('GALLERY_IMG_DIR', 'C:/webroot/gallery/images/gallery/');

 

// When we upload an image the thumbnail is created on the fly

// here we set the thumbnail width in pixel. The height will

// be adjusted proportionally

define('THUMBNAIL_WIDTH', 100);

 

// make a connection to mysql here

$conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error());

mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error());

?>

Link to comment
https://forums.phpfreaks.com/topic/79183-webroot-and-directory-problem-in-php/
Share on other sites

What do you mean by adding . or .. to the script? If you're talking about directory listing, I don't see any code that does that.

And a tip: Try to keep your directories relative, to make it easier for cross-platforming. If not that, then at least use standard directory conventions (posix/unix/whatever-style).

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.