1 (edited by beotiger 2006-03-05 16:31)

Topic: PunUploadExtra 1.1

##
##
##        Mod title:  PunUploadExtra
##
##      Mod version:  1.1
##   Works on PunBB:  1.2.*
##     Release date:  2006-03-05
##           Author:  beotiger (beotiger@yandex.ru)
##
##      Description:  This mod allows your forum users upload their files to the
##                    site and download them. Also the mod has permission system for upload 
##                    managing. All file management goes through this mod.
##                    AM plugin is included to  
##                    set permissions for usergroups.
##
##   Affected files:  none
##
##       Affects DB:  Yes
##
##            Notes:  This mod was originally based on punUpload 1.1.1 by 
##                    ultime (Pierre-Luc Lacroix - ultime@omgultime.com),
##              and UploadMoD by Yevgen Zinchenko aka Loiso (loiso@ukrtop.com), 
##              but has been much rebuilt and added many new features
##                                         
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download here

Main comments for the first release see at http://punbb.org/forums/viewtopic.php?id=10707

There are main changes:
1. Fixed all possible vulnerabilities.
2. French localization have been added (due to Apupv participating - we thank him!)
3. Filenames and their descriptions are now truncated to 30 characters in the next way:
    - if the length of filename is more than 30 characters long, it's outputed as first symbols of filename, '...', and its extension (so no more than 30 characters shown);
    - all words in description extended 22 characters cut to 22 characters.
   
4. All files in directory uploaded/ now can not exceed 100 Mbytes in size (this value regulates by the constant MAX_DIR_UPLOAD in the first line in file uploads.php, so you can change it to whatever you wish).

Living demo look at http://punbb.awardspace.us/uploads.php (russian test forum)

We recommend to upgrade, for upgrading is quite easy - just replace the main file uploads.php in the forum root directory by the one from archive, and you are done!

Re: PunUploadExtra 1.1

Hi,

I've just installed this mod and everything looks to be in the right place, but I'm getting an error with every attempt at uploading.

The error (right after i select the file and hit the "upload" button) is:

An error was encountered
Error: [filename] - could not upload the file.


Does anyone have any thoughts about what might be wrong?

Thanks very much.

- Mike

Re: PunUploadExtra 1.1

I cant figure out  why a lot of the time the filesize is 0

Re: PunUploadExtra 1.1

mikedilo
nectere

Couldn't you be just more precise?
What kind of files you've tried to upload?
filename, size, etc.

5 (edited by mikedilo 2006-03-21 14:31)

Re: PunUploadExtra 1.1

Sure. I've tried various types - .doc, .jpg, .txt - and the sizes have all been fairly small (7k, 75k, 26k...certainly nothing more than 100k). The filenames have varied, but none have been more than 25-30 characters long, and none have had any extra spaces or . in them (one recent example: Icon_Mag_Summer04cover.jpg).

I'd changed the max file size (in Administration > Plugins > Uploads Conf) to 2000k for all user types right after I first installed. And all user types have upload permission (for now until I get things working...I'll remove the guests' permission after that).

Thank you for your reply and for any other information you can provide.

6 (edited by beotiger 2006-03-21 18:46)

Re: PunUploadExtra 1.1

Ok, mikedilo.
One more question.
Please check your next php.ini setting:

; Whether to allow HTTP file uploads.
file_uploads = On

Is it the same?

Re: PunUploadExtra 1.1

Thanks for your reply.

Yes, my php.ini file shows the following code related to file uploads:

;;;;;;;;;;;;;;;;
; 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 =

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

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

Please let me know if you have any other suggestions.

Thanks for your help.

- Mike

Re: PunUploadExtra 1.1

File types are zip and rar, only those two types are allowed for this uploader. I have to keep a zip/rar policy because some files are huge.

I am thinking that some of the files might be too small to register even 1kb in your uploader mod since they are in the byte range. On my computer they show up as 1kb its just when I upload them they turn into 0kb files although you can still download them and they work fine, it just looks weird in the uploader directory. I dont want to have to explain over and over again that those files really arent 0kb.

Re: PunUploadExtra 1.1

I knew this fact (about file sizes = 0Kb) but never thought it could be a kind of problem to anyone.
To correct this just edit file uploads.php in your forum root directory, find  line #469, which should look like that:

<td class="puncon2" align="center"><?php echo round(@filesize('./uploaded/'.$info['file']) / 1024).' KB'; ?></td>

ok. Replace word 'round' with  'ceil'  (without quotes, of course).
It should work.

Re: PunUploadExtra 1.1

mikedilo

Have I taken it right, that you can not upload ANY file through the mod on your forum?
Please, give me a link to your forum, I just wish to see it myself.

Re: PunUploadExtra 1.1

Excellent that worked, thank you for the help and explanation! big_smile

Re: PunUploadExtra 1.1

Okay, here is a link to the forum: www.AdaptiveEnvironments.org/punbb

Thanks,
Mike

Re: PunUploadExtra 1.1

mikedilo
Yes, I should accept that one can not upload files on your forum.
May be it's for the settings of your host's webserver.

Oh, what's the permissions of the directory uploaded/ in your forum? It should be 755.

nectere
Glad to help you. May be there is more neat solution to show file sizes that are less than 1Kb in bytes.

14 (edited by nectere 2006-03-23 15:13)

Re: PunUploadExtra 1.1

beotiger, that's ok, I suppose it could be changed to show bytes, but really not all that many files will be in just the byte range so I am perfectly happy with this solution. Thanks again and I appreciate your answering my questions with expedience and thoughtful explanation. big_smile

15 (edited by mikedilo 2006-03-23 15:43)

Re: PunUploadExtra 1.1

beotiger,

thanks for the reply. just to answer your last question, yes, the permissions are set as 755 (on both 'punbb' and 'uploaded' directory).

i guess i can try checking with my web host.

one thing that's a bit confusing though is that i have some project management software installed elsewhere on the site, and there aren't any problems with file uploads there. that makes me think that it shouldn't be a web host/server issue.

oh, is that particular error message triggered by a specific type of action, or is it a very general error message that could happen for all sorts of reasons?

thanks,
mike

Re: PunUploadExtra 1.1

mikedilo

That's  complicating all things.
But the mod does work on several hosts, at least. I just can't take it why it is not so in your particular case.

What's the version of your PHP, what kind of web server installed on your host? May be the problem hides in that?

Are there any files in your uploaded/ directory (even after errorneous uploads)?

Re: PunUploadExtra 1.1

beotiger,

responding to your questions:

PHP Version 4.3.2
FreeBSD 4.4

No, none of the attempted upload files appear in the uploaded directory.

thanks for the reply.

Re: PunUploadExtra 1.1

mikedilo

May I ask you a question?
What is the PHP setting  post_max_size in your php.ini file?

For the rest, your system seems to be ideal for this mod working.

Re: PunUploadExtra 1.1

beotiger,

thanks for your reply.

post_max_size is set to 8M (so i guess that wouldn't cause a problem).

please let me know if you have any other thoughts.

thanks,
mike

Re: PunUploadExtra 1.1

Ok. So we need to approach it from another end.

This error (could not upload a file) can appear on one string only, string number 242, which is:

    if(!move_uploaded_file($temp_name, PUN_ROOT.'/uploaded/'.$file_name)  || filesize(PUN_ROOT.'/uploaded/'.$file_name)==0 ) 
        {
            error("{$file_name} - ".$lang_uploads['Err file couldnot'], __FILE__, __LINE__, $db->error());
        }

It seems to be not working command move_uploaded_file, which just moves uploaded file from tmp directory to our specified directory (forum/uploaded).

Oh, just one thought come to me -
try to set the next php setting -

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = /tmp

(i.e. uncomment your default setting and add a new value)

I hope we will do this together... eventually

Re: PunUploadExtra 1.1

this mod have a vulnerabilitie
for secuirity reason i dont post it here - author please contact me (icq 70593899 me russian too) - i make a patched version if anyone need it contact me
sorry for bad english

Re: PunUploadExtra 1.1

Thanx to all!
I've been aware of such vulnerability yesterday, and have had time to take some steps.

You must upgrade right now!
Patched file (if one can call it that) is placed here: http://www.punres.org/download.php?id=835
All you need is download, unzip and replace that file in your forum root directory.


I beg your pardon for all possible inconveniences.

23

Re: PunUploadExtra 1.1

My stylesheet is limiting my forum to 800 pixels ( I want it this way).
This makes a problem with the uploader. The file list is too wide and breaks out of the forums boundaries making it look bad.
Is there a way to wrap the text in the fields so it can adapt to the 800 px width ?

Re: PunUploadExtra 1.1

franke
Sorry, but if you limit yourself up to 800 pixels wide, there is no way to  use this mod.
So consider upgrading your system up to 1000or more pixels wide,so you you can use this mod without any problems.

Re: PunUploadExtra 1.1

This mod is really nice, but whenever someone uploads a picture.. they have to save the file locally then open it in order to view it.. and I have a few computer novices that use the forum.. that makes that part difficult.. if you choose open.. you just get a blank screen.. anyone know whats wrong? is it my php.ini? apache? or is it something in this file I could change?