Thank you Chad, this was very helpful.
If others want to do the same just look at the method is initializeFromUpload() within
includes/specials/SpecialUpload.php. Make sure all of those variables get set correctly
before running processUpload().
Thanks for your help,
[mailto:firstname.lastname@example.org] On Behalf Of Chad
Sent: Monday, June 29, 2009 1:37 PM
To: Wikimedia developers
Subject: Re: [Wikitech-l] Automate uploading files
On Mon, Jun 29, 2009 at 12:38 PM, Beebe, Mary J<BeebeM(a)battelle.org> wrote:
I am trying to automate uploading images (or files).
We are currently using mediaWiki version 1.13.2.
I am using the following code:
$webrequest=new FauxRequest( $data, true );
$uploader=new UploadForm( $webrequest );
$fname is a relative file name, while ="$bulkImageDirectory/$fname" is the
absolute file name. The file is located in wiki/images/tmp/bulkImages/.
I receive the error: "The file you uploaded seems to be empty. This might be due to
a typo in the file name. Please check whether you really want to upload this file."
And the upload form displays on the screen with wpDestFile filled in.
Do you know what the problem is?
Yes, you need to set mFileSize (not mUploadSize, there's no such thing) and
mSrcName (not sure what to, offhand...). I'd suggest taking a look at
internalProcessUpload() and its various return states for more info.
Is there another way to automatically upload a file
within an extension?
What you're doing is the only way (right now) to really do this. It sucks,
yes. Hopefully the new-upload branch will make this sort of thing easier
and less prone to error.
Is there documentation on this?
Not really :\
Wikitech-l mailing list