Local Path Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tomcat7194
Forum Commoner
Posts: 48
Joined: Mon Jul 31, 2006 1:34 pm

Local Path Error

Post by Tomcat7194 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello. 

I just transfered the website Freewaresounds.com to a new buyer. Since it's built on wordpress, I just cloned the wordpress database on the new server. Everything seems to be working fine, except for one function, which is supposed to display the file size of files uploaded by the wordpress downloads plugin. For some reason, it's producing an error when it tries to local the file on the server:

Code: Select all

Warning: filesize() [function.filesize]: Stat failed for /public_html/freewaresounds/wp-content/uploads/PigOink.wav (errno=2 - No such file or directory) in /home/freewsou/public_html/wp-content/plugins/Downloads.php on line 1456
This is the structure of the SQL database that it's referencing:

Code: Select all

-- phpMyAdmin SQL Dump
-- version 2.10.0.2
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Sep 05, 2007 at 07:04 PM
-- Server version: 4.1.22
-- PHP Version: 4.4.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- 
-- Database: `freewsou_wrdpr1`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `wp_dlmap`
-- 

CREATE TABLE `wp_dlmap` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `url` varchar(255) NOT NULL default '',
  `localpath` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

-- 
-- Dumping data for table `wp_dlmap`
-- 

INSERT INTO `wp_dlmap` VALUES (1, 'http://www.freewaresounds.com/wp-content/uploads/', '/home/freewsou/freewaresounds/wp-content/uploads/');
The function worked fine on the old server. I tried experimenting with the localpath, but to no avail. Any idea how I ought to approach this?

Thanks
Tom


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It would appear you are calling filesize() with a leading slash, thereby telling php to look in the root. This probably isn't the case as noted by the error message information.
Tomcat7194
Forum Commoner
Posts: 48
Joined: Mon Jul 31, 2006 1:34 pm

Post by Tomcat7194 »

Do you mean the leading slash before home in the SQL database, or is there a misplaced leading slash within the code for the page itself?
Tom
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The path given to filesize() wherever it may come from.
Post Reply