Page 1 of 1

Local Path Error

Posted: Wed Sep 05, 2007 12:05 pm
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]

Posted: Wed Sep 05, 2007 12:43 pm
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.

Posted: Fri Sep 07, 2007 1:50 pm
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

Posted: Fri Sep 07, 2007 2:00 pm
by feyd
The path given to filesize() wherever it may come from.