[wp-trac] [WordPress Trac] #17604: wp.uploadFile overwrite doesn't work
WordPress Trac
noreply at wordpress.org
Sat Mar 14 15:54:56 UTC 2015
#17604: wp.uploadFile overwrite doesn't work
---------------------------------+-----------------------------
Reporter: M66B | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: XML-RPC | Version: 3.2
Severity: normal | Resolution:
Keywords: has-patch 3.6-early | Focuses:
---------------------------------+-----------------------------
Comment (by marco_hoyer):
Hi there, what's the matter with this bug? I would like to have unique
media names in my wordpress and thus overwrite existing files but if I set
overwrite=True via xml-rpc api, strange things happen. Wordpress creates
files with "wpid-" prefix, which seems to be caused by the two lines
mentioned above. They also don't get overwritten but created several times
with the same strange name.
My Wordpress: Version 4.1.1
My request:
{{{
POST /xmlrpc.php HTTP/1.1
Host: test.shop.de
Accept-Encoding: gzip
User-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)
Content-Type: text/xml
Content-Length: 23651
<?xml version='1.0'?>
<methodCall>
<methodName>wp.uploadFile</methodName>
<params>
<param>
<value><int>0</int></value>
</param>
<param>
<value><string>my-user</string></value>
</param>
<param>
<value><string>my-secret</string></value>
</param>
<param>
<value><struct>
<member>
<name>bits</name>
<value><base64>
...
</base64></value>
</member>
<member>
<name>type</name>
<value><string>image/jpeg</string></value>
</member>
<member>
<name>name</name>
<value><string>test.jpg</string></value>
</member>
<member>
<name>overwrite</name>
<value><boolean>1</boolean></value>
</member>
</struct></value>
</param>
</params>
</methodCall>
}}}
Created Files:
{{{
{'type': 'image/jpeg', 'id': '571', 'file': 'wpid-test.jpg'}
{'type': 'image/jpeg', 'id': '572', 'file': 'wpid-test.jpg'}
{'type': 'image/jpeg', 'id': '573', 'file': 'wpid-test.jpg'}
{'type': 'image/jpeg', 'id': '574', 'file': 'wpid-test.jpg'}
{'type': 'image/jpeg', 'id': '575', 'file': 'wpid-test.jpg'}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17604#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list