Wikka Mod 015

Type: Feature Addition

This is the info about the version of the {{files}} action currently included in Wikka.
  • For the development page, take a look at FilesAction.
  • For a documentation of how to use the current version, look at FilesActionInfo.
 


Credit:

VictorManuelVarela


Files Action

This action allows easy file uploading/downloading from a wakka page.

All you have to do is:

Note: The mime_types file HAS to exist. If it doesn't, the pagehandler writes "ERROR: unreadable file mime.types" at the beginning of the file you want to download - not to the browser screen, as it should. You have to create an empty mime types file in the Wakka root directory, like "touch mime.types"
--TobiasHesselmann
Comments
Comment by i1008140
2004-09-02 09:15:57
It might be a Safe Mode problem on my side, but the directories created by File Upload and the images uploaded through it are owned by Apache. So I cannot delete those.

Furthermore, when I try to delete files, I get the following error:

Unknown method "page/files.xml?action=delete.php"

Strange...
Comment by DarTar
2004-10-01 17:38:21
I'm having some problems with the file action shipped with Wikka 1.1.5.2.

It seems that only the wikka admin (and not all users with write privs) has access to the upload form. Is anyone else experiencing this problem?
Comment by JsnX
2004-10-02 16:49:06
There probably needs to be some discussion about this. I don't feel comfortable including an action that--by default--would allow almost anyone to start uploading files to someone else's website. If this were the default behaviour, Wikka installations might become the target of people looking to share underground files.

There's also an issue with space usage. Someone could upload many, many files and use up all of a site's space.

If a Wikka admin is not watching her site, these could be serious issues.

So, I chose to make it so that only admins can upload files, by default. Of course the code can be tweaked to allow others to upload. Maybe there should be a configuration option that would specify upload access.
Comment by JavaWoman
2004-10-04 07:34:46
JsnX,
While I understand your concern (I share it) I'm not happy with WikiMasters needing to "tweak code" to enable/disable a feature.
Should be a configuration option, IMO. (IOW, allow a WikiAdmin to do it, rather than having WikiMaster edit code - see WikiRoles! After installation and initial configuration it should not be necessary to hack code).
(repost - wish I could *edit* my own comments!)
Comment by JavaWoman
2004-10-04 07:36:36
Another idea:
- allow only registered users to upload files
- give make it so that files are automatically uploaded in a "user's" (sub)directory
- give users a quota over which files can no longer be uploaded
Something like that would probably address most of the concerns - at least *limit* any "damage".
Comment by JavaWoman
2004-10-04 08:03:16
Other possible tweaks to enable "watching what's happeneing":
- allow an Admin to receive a notification by email whenever a file is uploaded ("allow" means making this a configurable option)
- create an RSS feed for all uploaded files
- add a "RecentlyUploaded" to the RecentChanges and RecentlyCommented options we have now
Comment by GmBowen
2004-10-09 23:22:36
I had the "file upload" action modified to an "image upload" action that does some of what JavaWoman suggests...although it uploads to an "approval" directory where a password protected, modified version of OTF Gallery allows the administrator to approve/reject images....if "approved" the image files are moved (and the prefix stripped off) to a users personal subdirectory (created by a modified registration script), if rejected the rejected image files are moved to a "reject" directory so I have a record if any problems (I'm working with kids remember....records are important). The modified script only allows a "set" number of uploads at once (by counting the number of files in the approval directory with the username...added as a prefix in the upload) and an overall total number of uploads (according to a field in the wakka_user table that tracks how many have been uploaded...and the script compares it to another field that is set, by default, in my database to 30). The php file is linked from the GmBowen page if anyone wants to play with it.

However, another way of dealing with the issue is to have the "fileupload" action added to a ""FileUpload"" page which could be created automatically when wikka installs (to a page where permissions are set, by default, only for the administrator to edit), and then the file upload script could be modified so that by using the parameter "users=name1, name2, name3" the administrator could designate other people who could upload from that page to a common directory. I've had Mark do this for several of the actions we've developed (not my image upload one as we dealt with security the way previously described) and it works quite well for allowing a designated list of users for an action (I know this approach violates some broadly accepted "tenet" of wiki use....but our interest was in sharing the use of tools amongst people in a project while maintaining the security for other content on the page). -- Mike
Comment by BartLebbink
2004-10-17 13:10:06
I'm having the same problem as DarTar. Only admin can upload files.
Comment by PolVazo
2004-11-18 20:42:49
To upload an image then display it on the same page I had to edit files.php and change mkdir 0755 to 0777. Then I put a .htaccess file in the uploads dir. In it I turned off the rewriting. Hope this helps someone...
Comment by AntonioGallo
2004-12-17 17:31:56
Please, somebody can add a download counter for any uploaded files?
Comment by GeorgePetsagourakis
2004-12-17 19:12:20
this would need a mysql table to store the hit count ...

it has to be discussed if this functionality is going to be in the next wakka and then if we can/should have a wakka_files table, i suppose ...
Comment by TimoK
2004-12-19 13:12:59
Ok, not sure if this is possible, but I would like to see a handler for files, so if I go to the SomePage/files I get a list of all files belonging to SomePage (and if I have the right to upload the upload form as well). This would be much more convenient than having to edit a page to insert the files-action, upload a file and re-edit to remove the action again (since it is not needed to be there all the time).
I am still new to Wikka and didnt look at the code a lot yet, so if I this impossible (or there is something like that built in already but I just didnt see) excuse my 'stupidity' please.
Comment by JavaWoman
2004-12-19 13:59:02
Timo, I don't know if it's possible (haven't looked at handlers much yet) but the idea is interesting and far from stupid!
Comment by ChristianBarthelemy
2004-12-19 14:36:12
I don't know if this is feasible nor if this would be the simplest solution, yet I agree that the way to upload a file is boring as it is now.
What I would suggest is to have two links in the header/footer menus: the first one would allow to upload files (depending on the authorizations), the second link would only be displayed when there are attachments in the upload folder for this page.
Comment by DarTar
2004-12-19 15:13:20
Definitely a good idea
Comment by ChristianBarthelemy
2004-12-21 23:05:06
Ok, very quick and dirty modification to turn this into a handler - works well
Comment by JavaWoman
2004-12-21 23:30:59
But with _only_ a handler you can no longer display a list of downloadable files within a page *in context*.

Maybe we need both an action (display list within page) and a handler (allow upload/rename/delete)?
Comment by ChristianBarthelemy
2004-12-22 00:17:04
I already transformed the files.php action into a listfiles.php action that does everythink alike except that it does not allow to delete nor upload. I am not sure this is ufelul - The file handler should display all available files even if you are not allowed to upload. Is anyone interested to get the listfiles.php action?
Comment by JavaWoman
2004-12-22 08:52:27
Well, I don't know if anyone agrees with me, bu t I do think a "listfiles" action is useful - like I said: display the available files on a page _in context_.
It would be more useful, I think, if someone could use it to only show "relevant" files or "their own" files - which needs more management than we currently have with just a single upload directory.

Also note that the current files action does have parameters for just creating a link (something a handler could/should not do) so it's halfway there.
Comment by DarTar
2004-12-22 10:07:39
Personally, I like Christian proposal of a handler. If pages are something like topics, I think it makes sense to be able to upload files (if the user has privileges to do it) to any page. Hence, I welcome the idea of a handler.
Comment by ChristianBarthelemy
2004-12-22 12:45:06
I just created the ListfilesAction
Comment by MyTreo
2005-02-01 19:28:35
For those people who can only upload files as admin and would like everybody with write access to be able to upload files: In files.php uncomment line 205 and comment line 206 instead.

Could anyone tell me please how I could modify files.php to only allow upload of .gif .jpg or .png files?
Comment by GmBowen
2005-02-01 21:20:49
my modified version of files which is meant for only uploading image files (to a specific directory) seen here.... http://131.202.167.33/wiki/actions/uploadimage.phps.... has code in it that does this. Hope that helps.
Comment by MyTreo
2005-02-02 15:41:50
Thank you GmBowen that will do the trick nicely.
Comment by S010600119575eb8d.cg.shawcable.net
2005-11-19 00:53:24
Hi,

I'm having trouble getting the files action to allow users to upload large files. I have modified the $max_upload_size variable in "actions/files.php", but to no avail. It looks to me like the action is supposed to give descriptive error messages (i.e. File too large, file name already exists, etc.) but those never show up. If I try to upload a big file (>2MB) the connection just hangs.

Thanks,
Patrick
Comment by 216.13.152.227
2006-02-14 13:56:48
I am also encountering this problem. Is there a way to allow a larger file upload limit?
Comment by WazoO
2006-02-14 15:08:25
Server OS isn't mentioned, but .... the 2Meg limit is a 'standard' default for PHP under *NIX. http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize .. and one might have to look at some settings in Apache also ...
Comment by TmO
2007-03-08 11:21:06
Patrick - For larger file sizes change max_upload_size in files.php, and for your PHP installation change post_max_size & upload_max_filesize in php.ini (then restart webserver)
TmO
Comment by TerriUser
2008-02-22 17:14:37
Given that files are organized by pages, Is there a way for a page to access another page's files? It would be really handy not to be limited by the page structure
Comment by DarTar
2008-02-22 18:32:31
Terri, there's been a lot of discussion on this and some of us have different views on the future architecture of file management in Wikka. My idea (similar to the Wacko implementation) would be to stick to the concept of files as page attachments and to consider a file attachment screen as a natural complement of a page (much as comments are). This would make the idea of a file action to be embedded in every page unnecessary. Being dependent on pages, permissions on files for use on different pages could be either tied to page read/write ACLs or be handled by dedicated (but still page-level) ACLs.

Others -- including JavaWoman if I remember correctly -- were in favour of a system in which file uploads are handled by a system completely independent from pages (similar to MediaWiki in this respect), with access control and permissions tied to users instead of pages. This would have totally different consequences in terms of design on how to refer to or embed a file in a page.

I'm afraid we haven't moved much further than this - you may want to take a look at the trunk version for the current status of implementation of file uploads.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki