Page MenuHomePhabricator

regular file upload in uploadable field not working
Open, Needs TriagePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • create a form with an "uploadable" field (in my case: input type=tokens
  • then edit a page with this form and try to upload a file

What happens?:

  • In the MW upload dialog, you can select a file. First problem: the predifined default filename gets replaced by the actual name of the file. This is not good, because then the user does not see the suggested filename anymore. Usually the filename for the upload gets selected (can be edited), but the name or the original file does not matter.
  • after the upload dialoge, you come back to the form, where NO filename is written in the field
  • when you save the page, no edit has been done, thus no reference to the file is stored on the page

What should have happened instead?:

  • The default filename should stay on the upload form and change only if I change it manually
  • the name of the uploaded file should be put in the form field.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
MediaWiki 1.35.3
PHP 7.4.22 (cgi-fcgi)
MySQL 5.7.33-log
ICU 63.1
PF 5.2.1 (01a2363) 19:05, 28. Apr. 2021

Related Objects

Event Timeline

create a form with an "uploadable" field (in my case: input type=tokens

Create a form using what?

I'm guessing this is an issue with some MW Extension...

oh, sorry. I forgot to tag the extension. Thank you, Aklapper!

It seems this is an issue with 1.35. I have PF 5.2.1 working with 1.31 where the regular upload field is working fine.
Maybe something changed in the MW upload dialog mechanism that PF is using.

The bug is also observed with MW 1.36.1 and PF 5.2.1.
The field becomes unusable for standard users, who do not understand how to get around this problem.

Sorry what's the issue - is it just with "default filename"?

after you upload the file and come back to the form the field where the filename should be is still empty

I tried to reproduce this problem, but couldn't. Maybe it has been fixed in the last few months?

part of it, yes. Uploading in general works now again.
But if you have something like

|default filename={{PAGENAME}}-Logo.jpg

in your uploadable form definition then the suggested name gets passed on the upload dialog (we are talking about $wgPageFormsSimpleUpload = false; here). But as soon as you select a file from your system, the suggested filename gets overwirtten with the filename from the system.
However this filename gets then correctly passed on to the form again, so it is definitely an improvement.

Also on a MW 1.35 instance with REL_135 checked out.
Error with $this-> in getInitialPageText which should be using wfMessage

Essentially /index.php/Special:UploadWindow is not working properly in MW 1.35.
Also confirmed in 1.36 for alternative reasons.

@rijvirajib - that sounds like a totally different error. What version of Page Forms are you running?

You are correct, this is a different error but the end result is the same, no filename in written field:

after the upload dialogue, you come back to the form, where NO filename is written in the field
when you save the page, no edit has been done, thus no reference to the file is stored on the page

I am using MW 1.35.1, PF 4.9.4 since 5.3.3 does not have PFGoogleMapsInput::getName() which I use for my forms to display a GoogleMap to grab a WKT Geography. I even grabbed REL1_35 (4.9.4) from git but that has the $this-> error (replacing with wfMessage in those 2 functions (getInitialPageText and getExistsWarning) resolves that issue.
I guess maybe something else is broken since Edit with Form doesn't show up on a form created. https://imgur.com/a/zCBA4jP

Either way, after I upload an image, I end up on a white screen: https://imgur.com/a/ZQUhSyP

When I close this screen to go back to my form, the form field is empty, as if the upload never happened (but the image has been successfully uploaded).

Well, I can't really help with old versions of the code - you really should upgrade to the latest version of Page Forms. If that getName() problem (which I don't understand) really is an issue, please create a separate Phabricator task for it.

I've updated to the latest 5.3.3 on MW 1.35.1 and disabled the extension GoogleMapsEditor (display a Google Maps for geography). The error persists, there is no callback to the Form page from the upload window dialogue; no file gets put into the form field when closing the blank white window.

on MW 1.35.1

@rijvirajib: For the records, you run insecure outdated software. Please upgrade for your own safety.

@Aklapper thank you. We are doing an upgrade now. If this fixes the errors with PageForms, I will update this page.

Just an update for you all, using 1.35.5 (not 1.35.3 which still has this issue) and the latest PageForms 5.3.4, everything is working as expected.