Topic on Project:Support desk

Fail to upload pdf

10
Loman87 (talkcontribs)

Yes, just pdf! Anyway, I get this error when trying to upload


[35107bde4eb37ec0d2143a4c] /mediawiki/index.php/Special:Upload MWException from line 496 of /var/lib/mediawiki/includes/filerepo/file/LocalFile.php: Could not find data for image 'file.pdf'.

Backtrace:

#0 /var/lib/mediawiki/includes/filerepo/file/LocalFile.php(654): LocalFile->loadExtraFromDB()

#1 /var/lib/mediawiki/includes/filerepo/file/LocalFile.php(919): LocalFile->load(integer)

#2 /var/lib/mediawiki/extensions/PdfHandler/includes/CreatePdfThumbnailsJob.php(112): LocalFile->getMetadata()

#3 /var/lib/mediawiki/includes/Hooks.php(177): CreatePdfThumbnailsJob::insertJobs(UploadFromFile, string, boolean)

#4 /var/lib/mediawiki/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)

#5 /var/lib/mediawiki/includes/upload/UploadBase.php(481): Hooks::run(string, array)

#6 /var/lib/mediawiki/includes/upload/UploadBase.php(347): UploadBase->verifyFile()

#7 /var/lib/mediawiki/includes/upload/UploadFromFile.php(95): UploadBase->verifyUpload()

#8 /var/lib/mediawiki/includes/specials/SpecialUpload.php(503): UploadFromFile->verifyUpload()

#9 /var/lib/mediawiki/includes/specials/SpecialUpload.php(207): SpecialUpload->processUpload()

#10 /var/lib/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialUpload->execute(NULL)

#11 /var/lib/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)

#12 /var/lib/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)

#13 /var/lib/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()

#14 /var/lib/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()

#15 /var/lib/mediawiki/index.php(42): MediaWiki->run()

#16 {main}


With other file extensions there is no problem. I check other similar issues but mine seems to be different (images directory permissions are 777; I don't run SELinux; pdf is an allowed file extension).

My version is

Product Version
MediaWiki 1.31.1
PHP 7.0.32-0ubuntu0.16.04.1 (apache2handler)
MySQL 5.7.24-0ubuntu0.16.04.1
ICU 55.1
Elasticsearch 5.6.1
Lua 5.1.5

Thanks for any help!

Lorenzo

Malyacko (talkcontribs)

What is the MIME type of 'file.pdf'? Command would be: file --mime-type -b file.pdf

Loman87 (talkcontribs)

Hi,

thanks for your answer. The MIME type is application/pdf. I have tried with different pdf but it doesn't work.

Loman87 (talkcontribs)
Bttfvgo (talkcontribs)

Any help? Ever since upgrading to MW 1.33 I have been experiencing the exact same error! I can't upload any new PDF files! At least time I got thumbnails working (couldn't get working for anything on 1.32...) but I have many PDF files I need to upload. Do you think importImages.php might do the trick?

Bttfvgo (talkcontribs)

Well I tried it and surprisingly enough, I was actually able to upload new PDFs. Or at least 3 out of the 4 I tried. The last three went through fine but the first one failed (even though the image was placed in the proper directory, it says it doesn't exist.) I can't reupload a copy because I get the same "Could not find data..." error. But this was also the file that failed the last time. So I'm not sure whether importImages worked, or whether those were files that the system might have accepted via upload without shooting out errors anyway. I guess I'll have to find more files I want to upload and see if they go through or fail. But I know the image is valid... it comes straight from Commons!

Bttfvgo (talkcontribs)
Bttfvgo (talkcontribs)

And yes I tried the "disable PDF handler, upload the file, and then re-enable it". It refuses to generate thumbnails and contains no metadata. There has to be something going on that I just can't figure out. (I've been getting more errors since I upgraded to 1.33 than I ever did before - no errors in 1.30. I'll figure them out, but SO much has changed between 1.32 and 1.33...)

Loman87 (talkcontribs)

The method "disable PDF handler, upload the file, and then re-enable it" worked for me with 1.31; maybe yours is something different, don't you have any backtrace?

Bttfvgo (talkcontribs)

It provided one almost identical to yours. Strangely enough, the file actually showed up, in all its glory, metadata and all, when I checked the next day. I haven't tried uploading any more PDFs since then, but if I have any problems, I'll certainly let you know!

Reply to "Fail to upload pdf"