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
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).

Link to comment
Share on other sites

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.