Previous Thread
Next Thread
Print Thread
Hop To
Anonymous
Unregistered
Anonymous
Unregistered
Its works fine on perl but dosnt on PHP
Hers my config files:
################################################################################################
PHP FILE:
################################################################################################
// Allow File Attachemnts. If you provide a path to a directory below
// then File Attachments will be allowed. If you leave it blank, then they
// will not. Make sure this directory is writeable by everyone
$config['files'] = "c://sites//clint//turbosport//bbs//bbsupload";

// We also need the url to the files directory
$config['fileurl'] = "http://bbs.turbosport.co.uk/users";

// Do you want to only allow certain file types, or exclude certain file
// types? Only uncomment one of the following. Seperate your filetypes with
// a , // $config[excludefiles] = ".php,.asp,.js,.vbs,.sht,.htm";
$config[allowfiles] = ".swf,.zip,.txt,.gif,.jpg,.jpeg,.bmp,.html,.htm";
// Maximum filesize allowed
$config['filesize'] = "100000";
################################################################################################
PERL FILE:
################################################################################################
# Allow File Attachments. If you provide a path to a directory below
# then File Attachments will be allowed. If you leave it blank, then they
# will not. Make sure this directory is writeable by everyone
$config{'files'} = 'c:/sites/clint/turbosport/bbs/bbsupload';

# We also need the url to the files directory.
$config{'fileurl'} = 'http://bbs.turbosport.co.uk/bbsupload';

# Do you want to only allow certain file types, or exclude certain file
# types? Only uncomment one of the following. Seperate your filetypes with
# a ,

# $config{'excludefiles'} = ".php,.asp,.js,.vbs,.sht,.htm";
$config{'allowfiles'} = ".swf,.zip,.txt,.gif,.jpg,.jpeg,.bmp,.html,.htm";


# If you are allowing file attachments then you need to set a maximum size
$config{'filesize'} = 100000;
################################################################################################

I have also tried this in the php file:

$config['files'] = "c:/sites/clint/turbosport/bbs/bbsupload";

Regards
Clint

Anonymous
Unregistered
Anonymous
Unregistered
I'm still having quite a time with file attachments myself. This is just about the only thing that is keeping me from switching over.

That other thing is the problem with opening up the intire ubbthreads directory to write permissions. If I just open the files up for writing, they're deleted, then the server doesn't have rights to create a new file. I'm using Win2k. Any ideas?

Hatter
www.carfaxabbey.net

Anonymous
Unregistered
Anonymous
Unregistered
My directory has full control for everyone.

The web site only needs read access !

Also on the file attachment directory you will need the user 'SYSTEM' to have full control.

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
</font><blockquote><font size="1" face="">quote:</font><hr /><font size="" face="">Originally posted by Clint Gaskin:
Its works fine on perl but dosnt on PHP
Hers my config files:
</font><hr /></blockquote><font size="" face="">The // actually needs to go in your php.ini file for your upload path.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
Rick what would my php.ini need to looklike ?

Regards
Clint

Anonymous
Unregistered
Anonymous
Unregistered
I take it in this section !
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = C:\PHP\uploadtemp ; temporary directory for HTTP uploaded files (will use system default if not specified)

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Yeah, Extrm Bob said it works under NT if you change that upload path to something like C://blah//blah

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
Nope just cant get it to work.

Are there no instructions for this anywhere ?

Also if you use the admin tool to update the config file it all ways deleted anything in this line:
$config[allowfiles] = "";
Even if you enter it in there manually when you edit config files in admin tools it will display the list but as soon as you click update it returns a blank line into the $config[allowfiles] = ""; line !!!! <img border="0" title="" alt="[Frown]" src="images/icons/frown.gif" />

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Only instructions I've found thus far are on the PHP site and searching google. However, it looks like a common problem is not having the upload_tmp_dir set to writeable by the webserver. Without that, it won't be able to write out the file. Oh, and I did ask you to check and make sure that you are not running in safe_mode correct?

As for the allowed_files problem, I'll take a look at that and see what's going on.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
My directory has all the correct permissions it worked with the perl version (and still does).

Whats safe mode <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" /> lol

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Safe_mode is a setting in your php.ini file as well. If this is turned on then file attachments won't work.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
nope its set to off !

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Hrmm, so what exactly is happening when you try to upload a file? Does it error, does nt come with any time of logging for IIS to see what is going on?

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
Thats the annoying thing, there are no errors anywhere just no upload and no attachment showing in the post !

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
That's a tough one to track. It could be that it isn't able to write to the temp dir, or the actual directory. The process it takes is PHP writes the file to the upload_tmp_dir, and then it checks the validity of the file, then it moves the file into the actual directory.

Here's a question. Does Windows show the last time a directory was accessed? If it does you might check this timestamp for the upload_tmp_dir and see if it's actually trying to write something to that directory.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
No dosnt seem like its even trying to access it !
I have done the following:

1. left the default temp dir to c:\php\uploadtemp
2. applied full control for everyone SYSTEM and ISR_USR
3. changed the config.inc.php to reflect the upload path, url and allowed file types

Anything else !

Regards
Clint

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Does it work when you change the temp_dir to C://php//uploadtemp? I realize it might not work still, but does it seem to try to access that directory with this change? If not then it's not even getting to the scripts portion of the routine, as this is just a native part of PHP that isn't working.

I'm only going by what another 2000 user has stated, and this is the change that he had to make to get this to work.

-------------------
Rick Baker
UBBThreads developer

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Oh, one other thing. Do you know the exact version number you are running. Just realized that it does need to be at least 4.0.3 or greater for uploads to work.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
4.0.6 from this file php406-installer.exe

Regards
Clint

Anonymous
Unregistered
Anonymous
Unregistered
Here is the exact way I got file uploads to work.

In php.ini make sure path looks like this:

C:\path\to\uploads\

Note the \ at the end of the path

Find the line below, its about line 871
// Doesn't support it, so we write our own function

else {
$filename = $userfile;
if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
$tmp_file = dirname(tempnam('', ''));
}
$tmp_file .= '/' . basename($filename);
$validfile = (ereg_replace('/+', '/', $tmp_file) == $filename);
if ($validfile) {
$goodfile = "yes";
}
}

if ($goodfile == "yes") {

Comment the above block of code out. You will be commenting out roughly from lines 872 to 884

Then at line 897 you should see:

$dbh -> do_query($query);

Just below it comment out the } should be on line 898 by itself.

The line numbers might be off. My copy of w3t is hacked up pretty much so that's why I posted the block of code to comment out.

It took me a lot of time to find the problem and it isn't a problem with the forum code but is a problem with php for windows. I found it by adding some error checking to output any errors that I wasn't seeing when posting a message with attachments. If you need any more help finding the code to comment out let me know. Like I said my line numbers might be off because of the amount of changes I made.

[b]Extreme VB Forums -[/b] Visual Basic Help

[This message was edited by Extrm Bob on 21 Oct 01 at 07:47 PM.]

Anonymous
Unregistered
Anonymous
Unregistered
Ok, I'm in the process of working this out. The file w3t doesn't exist in the ubbthreads version of this (at least from what I can find).

I did a search for a file containing the string:
(!$tmp_file = get_cfg_var('upload_tmp_dir'))

And came up with the file: addpost.php

I made the correct changes, and it now works!! <img border="0" title="" alt="[Big Grin]" src="images/icons/grin.gif" />

Now, my question is this: How long before this is incorporated into the official release of the product? Thanks for everyone's help.

Hatter
www.carfaxabbey.net

Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
I'll need to see how these affect the Linux platform. I definitely will get this fix in, just might need to make some adjustments so it will work on both platforms.

-------------------
Rick Baker
UBBThreads developer

Anonymous
Unregistered
Anonymous
Unregistered
I must be stooooopid still cant get it to work !
Am I missing somthing ?

the directory has ISR_User Everyone and SYSTEM in the permissions tab all with FULL control !

here are my config files:
###############
config.inc.php:
###############
// Allow File Attachemnts. If you provide a path to a directory below
// then File Attachments will be allowed. If you leave it blank, then they
// will not. Make sure this directory is writeable by everyone
$config['files'] = "c:/sites/clint/turbosport/bbs/bbsupload";

// We also need the url to the files directory
$config['fileurl'] = "http://bbs.turbosport.co.uk/bbsupload";

// Do you want to only allow certain file types, or exclude certain file
// types? Only uncomment one of the following. Seperate your filetypes with
// a , // $config[excludefiles] = ".php,.asp,.js,.vbs,.sht,.htm";
$config[allowfiles] = ".txt,.php,.asp,.js,.vbs,.sht,.htm";
// Maximum filesize allowed
$config['filesize'] = "100000";

#####################
And the addpost.php
#####################

// ------------------------------------------------
// Doesn't support it, so we write our own function
// else {
// $filename = $userfile;
// if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
// $tmp_file = dirname(tempnam('', ''));
// }
// $tmp_file .= '/' . basename($filename);
// $validfile = (ereg_replace('/+', '/', $tmp_file) == $filename);
// if ($validfile) {
// $goodfile = "yes";
// }
// }

// if ($goodfile == "yes") {
$FileName = "$Mnumber-$userfile_name";
copy($userfile, "$config[files]/$FileName");

// ------------------------------------
// Update the post to set the file name
$Filename_q = addslashes($FileName);
$query = "
UPDATE w3t_Posts
SET B_File = '$Filename_q'
WHERE B_Number = '$Mnumber'
AND B_Board = '$Board_q'
";
$dbh -> do_query($query);
// }
}

Regards
Clint

Anonymous
Unregistered
Anonymous
Unregistered
oh and my php.ini file:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = C:\PHP\uploadtemp\ ; temporary directory for HTTP uploaded files (will use system default if not specified)

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Regards
Clint

Anonymous
Unregistered
Anonymous
Unregistered
OK Guys sorted it .. Ill post how as soon as I have worked it out myself <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />

Thanks to everyone !

Regards
Clint


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
3 members (rootman, Gizmo, Nightcrawler), 562 guests, and 186 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)