I would like to see upload.module post watchdog notice entries when users try to submit files that exceed quota / maxfilesize / incorrect extension / filename too long.

This feature facilitates administering a site where the users have limited technical ability (i.e. the users file a request for help that looks like: "I tried to add the file like I usually do but the site is broken and it wouldn't let me. Yes, there was some kind of error message but I can't remember what it was.")

I have added the necessary code (4 watchdog calls) to upload.module for the site in question. I could roll a patch fairly easily if this feature is something that would be useful to more users.

CommentFileSizeAuthor
#2 patch_upload_with_watchdog.txt1.82 KBvjordan

Comments

RobRoy’s picture

Version: 5.x-dev » 6.x-dev

Would be a great feature for 6.x-dev. A patch would be very useful (http://drupal.org/patch). I'm surprised this isn't in there already. Go for it!

vjordan’s picture

StatusFileSize
new1.82 KB

patch enclosed rolled against HEAD. If the patch should be rolled against some other branch let me know. I've tested this against my 5.1 install and works okay. I'm still getting to grips with the patching process - let me know if this doesn't work for you and I can re-roll.

A couple of questions:

  1. Is it okay to introduce a new watchdog type "upload"? Is there an existing type which would be more appropriate to use?
  2. Should changes to size restrictions / quotas / permitted extensions also be logged to watchdog? (Not sure how this would be done, but could investigate.)

Note: I notice some problems with the way my installation is handling upload.

  • There seems to be a problem with the long filenames (>255 characters). The upload doesn't finish. I'll have to wait until tonight to check out the apache logs to where the problem might be.
  • The checks against quota and filesize are a bit hit-and-miss. Could it be something to do with caching the query result that calculates how much space is being used?

These are separate from raising watchdog entries so I'll log bug reports if I can get any details. Might be something for others to also look out for if they test the error conditions and notice unpredictable behaviours.

vjordan’s picture

Status: Active » Needs review
bdragon’s picture

Status: Needs review » Needs work

Doesn't apply anymore. The function you modified doesn't even exist any more. I *think* you are looking for upload_node_form_submit() now.

vjordan’s picture

I see that v6 doesn't have function_upload_validate any more. I haven't been following v6 development closely and don't yet have a v6 install configured.

A quick look around suggests that file_save_upload might be the correct place to insert the watchdog calls, right after the drupal_set_message calls and before the return 0 in the switch statement.

drewish’s picture

i suppose you could call this a usability improvement... maybe it should be postponed for 7.

but file_save_upload() would be the right place for this. you could just log their errors all at once.

drewish’s picture

i suppose you could call this a usability improvement... maybe it should be postponed for 7.

but file_save_upload() would be the right place for this. you could just log their errors all at once.

pancho’s picture

Version: 6.x-dev » 7.x-dev

Unfortunately this is really too late now, as it would introduce new strings. Moving to D7 queue.

webchick’s picture

Title: upload.module post watchdog entries » Post errors when upload problems occur
Component: upload.module » file system
Status: Needs work » Fixed

Looking at http://api.drupal.org/api/function/file_save_upload/7 it seems this has been fixed this release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.