Hello,
I am stuck with image uploading from file system
I have a path c:\images\abc.jpg
This image I want to upload on wiki but it doesnt work
sample code looks like
$file = "c:\images\D4215_0_0.jpg"; $data = "action=upload&filename=$file&token=%2B%5C";
$path = "/mediawiki/api.php"; echo "socket opened"; fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-type: multipart/form-data \r\n"); fputs($fp, "Content-length: ". strlen($data) ."\r\n"); fputs($fp, "\r\n"); fputs($fp, $data);
can you please help me whats wrong here?
2010/2/11 Herulee heramb.forums@googlemail.com:
Hello,
I am stuck with image uploading from file system
I have a path c:\images\abc.jpg
This image I want to upload on wiki but it doesnt work
You should ask these questions on a different list, like mediawiki-l or wikitech-l. This list is about the bot API.
Roan Kattouw (Catrope)
Thanx for the reply.I will post the message on specified list
On Thu, Feb 11, 2010 at 4:35 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
2010/2/11 Herulee heramb.forums@googlemail.com:
Hello,
I am stuck with image uploading from file system
I have a path c:\images\abc.jpg
This image I want to upload on wiki but it doesnt work
You should ask these questions on a different list, like mediawiki-l or wikitech-l. This list is about the bot API.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
But I want to upload it using api Is it possible to do it?
On Thu, Feb 11, 2010 at 5:01 PM, Heramb Lele heramb.forums@googlemail.comwrote:
Thanx for the reply.I will post the message on specified list
On Thu, Feb 11, 2010 at 4:35 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
2010/2/11 Herulee heramb.forums@googlemail.com:
Hello,
I am stuck with image uploading from file system
I have a path c:\images\abc.jpg
This image I want to upload on wiki but it doesnt work
You should ask these questions on a different list, like mediawiki-l or wikitech-l. This list is about the bot API.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Heramb Lele wrote:
But I want to upload it using api Is it possible to do it?
Are you expecting to give the api the filename on your computer and get it uploaded? It could only work if the file was on the same computer as the wiki. The api doesn't support that, that is done with maintenance\importImages.php script.
Yes right, I wan to give the filename on my comp to uplad the file on wiki server through API So there is no any other way to upload images remotely?
On Thu, Feb 11, 2010 at 5:46 PM, Platonides platonides@gmail.com wrote:
Heramb Lele wrote:
But I want to upload it using api Is it possible to do it?
Are you expecting to give the api the filename on your computer and get it uploaded? It could only work if the file was on the same computer as the wiki. The api doesn't support that, that is done with maintenance\importImages.php script.
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Heramb Lele wrote:
Yes right, I wan to give the filename on my comp to uplad the file on wiki server through API So there is no any other way to upload images remotely?
The data has to be sent over the wire. When using Special:Upload you only provide the filename and your browser sends its contents. With the api, whatever program that is using the api has to do it.
ahh ok..
I am trying to upload it using action=upload using api,php Is it possible?
Roan Kattouw-2 wrote:
2010/2/11 Herulee heramb.forums@googlemail.com:
Hello,
I am stuck with image uploading from file system
I have a path c:\images\abc.jpg
This image I want to upload on wiki but it doesnt work
You should ask these questions on a different list, like mediawiki-l or wikitech-l. This list is about the bot API.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
2010/2/11 Herulee heramb.forums@googlemail.com:
ahh ok..
I am trying to upload it using action=upload using api,php Is it possible?
You'll have to tell us exactly how it "didn't work". Did you get error messages? What did they say?
Roan Kattouw (Catrope)
I read in some post that Image uploading is not possible in the version 1.15.1 through API is it true?
On Thu, Feb 11, 2010 at 5:34 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
2010/2/11 Herulee heramb.forums@googlemail.com:
ahh ok..
I am trying to upload it using action=upload using api,php Is it possible?
You'll have to tell us exactly how it "didn't work". Did you get error messages? What did they say?
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Still when I try to run the above code it gives me this
<?xml version="1.0"?> <api> <error code="help" info="" xml:space="preserve">
HTTP/1.1 200 OK Date: Thu, 11 Feb 2010 15:34:23 GMT Server: Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6 X-Powered-By: PHP/5.2.6 MediaWiki-API-Error: help Expires: Thu, 01 Jan 1970 00:00:01 GMT Cache-Control: s-maxage=0, must-revalidate, max-age=0 Vary: Accept-Encoding X-Vary-Options: Accept-Encoding;list-contains=gzip Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8
13447
On Thu, Feb 11, 2010 at 5:40 PM, Heramb Lele heramb.forums@googlemail.comwrote:
I read in some post that Image uploading is not possible in the version 1.15.1 through API is it true?
On Thu, Feb 11, 2010 at 5:34 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
2010/2/11 Herulee heramb.forums@googlemail.com:
ahh ok..
I am trying to upload it using action=upload using api,php Is it possible?
You'll have to tell us exactly how it "didn't work". Did you get error messages? What did they say?
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Hi,
Except from the issue that Platonides mentioned, there is something else wrong with your postdata
On Thu, Feb 11, 2010 at 2:10 PM, Herulee heramb.forums@googlemail.com wrote:
$file = "c:\images\D4215_0_0.jpg"; $data = "action=upload&filename=$file&token=%2B%5C";
This is urlencoded data.
fputs($fp, "Content-type: multipart/form-data \r\n");
You specify multipart/form-data. When you specify that you send multipart/form-data, it's not going to work if you send urlencoded data. You need to send the data in the encoding that you specify; you can't expect it to work otherwise.
Bryan
Thanx Bryan and Platonides for the reply
I am still couldnt manage to upload the image
Could you please elaborate more what should be done
I tried to access the page http://en.wikipedia.org/wiki/Special:Upload
it displays
From Wikipedia, the free encyclopedia
Jump to: navigation http://en.wikipedia.org/wiki/Special:Upload#column-one, search http://en.wikipedia.org/wiki/Special:Upload#searchInput
The action you have requested is limited to Autoconfirmed usershttp://en.wikipedia.org/wiki/Wikipedia:Autoconfirmed_users, Administrators http://en.wikipedia.org/wiki/Wikipedia:Administrators, Confirmed users http://en.wikipedia.org/wiki/Wikipedia:User_access_levels.
Return to Main Page http://en.wikipedia.org/wiki/Main_Page.
On Thu, Feb 11, 2010 at 7:45 PM, Bryan Tong Minh bryan.tongminh@gmail.comwrote:
Hi,
Except from the issue that Platonides mentioned, there is something else wrong with your postdata
On Thu, Feb 11, 2010 at 2:10 PM, Herulee heramb.forums@googlemail.com wrote:
$file = "c:\\images\\D4215_0_0.jpg"; $data = "action=upload&filename=$file&token=%2B%5C";
This is urlencoded data.
fputs($fp, "Content-type: multipart/form-data \r\n");
You specify multipart/form-data. When you specify that you send multipart/form-data, it's not going to work if you send urlencoded data. You need to send the data in the encoding that you specify; you can't expect it to work otherwise.
Bryan
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org