Hello all, sorry if this is a noobish question, but I get strange problems when trying to
upload a newly generated image from within an extension. It's seems the title of the
calling page gets corrupted getting the name of the uploaded file), and sometimes the
resulting image, despite being called File:XXX, end up in the main namespace. At times
there are also a lot of UNIQ/QINU-strings in the page. These problems seem to appear both
when doing the upload from the job queue, and when uploading at once. I am, by the way,
not using any globals like $wgOut.
This is the actual upload lines (it inside an Semantic MediaWiki Result Printer class, but
I've had the same problems when trying it in an ordinary MediaWiki parser function):
$ulUser= User::newFromName($myUserName);
$mUpload = new UploadFromUrl(); $mUpload->initializePathInfo (
$filename, $tempdir, false );
$status = $mUpload->getLocalFile()->upload( $tempdir . '/' . $filename,
$tempdir, $description, 0, false, false, $ulUser );
if ( $status->isGood() ) { unlink($tempdir . '/' . $filename); return
true; } else { ... }
I'm not a programmer, so the code is probably quite ugly. I'm not even sure this
is the proper way to do a file upload, but it's the only way I found working. Any
help would be greatly appreciated (e.g. examples of extensions doing file uploads, making
it work)!
Best regardsLeo Wallentin
Leonard Wallentin
leo_wallentin(a)hotmail.com
+46 (0)735-933 543http://säsongsmat.nu
http://nairobikoll.se/
http://twitter.com/leo_wallentin
Skype: leo_wallentin
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
mQENBE1JuiUBCADsAnoxo1o3G2Apkjs8NHSfbN4g/H8HbS4XXfjruZ6Afu6PBMJI
CoiopKmTzQojjUZEjM2i4QsynU2xX4PmpMloPCOXEWxQg7q6HgHKyBU9NroL+17T
WA/30jGTmi2pkuznX1LpYKz0r8oSUsrg9oIeJmSbPRP6bNjwlgaDzarfYjcfEFXu
Y0s8KdVT1M8Zw2Sq7QuYPaiT+gfLMN5FaCzCZPdHZu8L1lXszTtFxztiF0hTd2C6
8yAW3DlTqTOSWqQtt10tf8VxeXPGxfqs6Ti8s5MsAsUtg9vw0A7gQC36SmRXel7W
l/rYbkESqDKANgIT6ofbIru0ozdy/BxnL2wXABEBAAG0LUxlb25hcmQgV2FsbGVu
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