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 ,
# If you are allowing file attachments then you need to set a maximum size $config{'filesize'} = 100000; ################################################################################################
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?
</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
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
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" />
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
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
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
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
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
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
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.
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
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"; // } // }
// ------------------------------------ // 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); // } }
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