Topic on Extension talk:SimpleBatchUpload

test for existing file

8
Summary by Revansx

author invites anyone interested in this feature to develop it and they will likely incorporate it.

Revansx (talkcontribs)

is there a way to disable SimpleBatchUpload for existing files?

For example: if I try to upload 12 files at once and 3 already exist, those 3 would fail and the other 9 would succeed. Is that possible?

139.169.25.120 (talkcontribs)

I am also interested in this or at least if the uploader could warn the user that the are overwriting an existing file.

Revansx (talkcontribs)

@F.trott, Has there been any updates that address this question?

F.trott (talkcontribs)

No, sorry. If you need this functionality you'll have to submit a patch.

Revansx (talkcontribs)

Ok. I'll be happy to try my hand at providing a patch that does this, but would you be willing to say a few words and provide a little guidance about where in the code this feature would be most efficiently added? All I'm asking for is a little help getting oriented under the hood.

F.trott (talkcontribs)

The whole extension is rather simplistic. It uses two elements: the MW Upload API and a jQuery File Upload Plugin. To implement your feature you would need to

  • introduce a switch on the server side to enable the feature. This could be a simple config variable if you want to always turn the feature on. You might also think of a case by case solution for the #batchupload parser function.
  • transfer the setting to the client. Either using a "data-" attribute in the generated HTML or a JS variable (see MakeGlobalVariablesScript and ResourceLoaderGetConfigVars hook).
  • use the setting on the client side. You'd have to make "ignore warnings" depend on the setting.

Depending on how sophisticated you want this to be you might add an option (button, link) to force uploading/overwriting after the first fail.

Revansx (talkcontribs)

I'll try to tinker with it. Thanks for your help. I'm still novice.

Revansx (talkcontribs)

I'd be happy to just hard-code it as the default behavior so it fails for files that already exist.

i'm using SimpleBatchUpload (SBU) to set the template and template properties upon upload.. the problem is that if the file already exists, then SBU ignores the template and template data.. such that after the batch upload the user doesn't know which files do and do not have the template data. I would also be happy if SBU could be made to overwrite the existing template data.. that would be fine too, but the current behavior of uploading the file and ignoring the template data if the file already exists ruins the usefulness of the template call feature. (unless i'm missing something)

-Rich