Cnblogs not upload pictures

 

When returned before May 28, 2019 a couple of months time, use cnblogs original interface, suggesting that the picture can not be uploaded, lack of space, there is no way that he realized the agency blog, upload pictures found 503 errors, had first pictures to other servers, and then release

http://www.cnblogs.com/qinqoushui/services/metaweblog.aspx

New Interface

https://rpc.cnblogs.com/metaweblog/QinQouShui

 

Then, cnblogs suddenly changed the interface to upload pictures to normal, everything is in vain

 

@@@code

public Stream newMediaObjectResponse(string blogid, string username, string password, FileData file)

{

// feasible, perpetrating a fraud, to achieve picture upload

if (string.IsNullOrEmpty(imageUrl))

{

mw.Credentials = new NetworkCredential(username, password);

var x = mw.newMediaObject(blogid, username, password, file);

return mw.newMediaObjectResponse(blogid, username, password, file).GetResponseStream();

}

else

{

string md5 = Q.Helper.HashHelper.MD5(file.bits);

string path = System.IO.Path.Combine(AppContext.BaseDirectory, "images");

if (!Directory.Exists(path))

Directory.CreateDirectory(path);

string fileName = md5 + "." + file.type.Split('/')[1];

if (!File.Exists(Path.Combine(path, fileName)))

File.WriteAllBytes(Path.Combine(path, fileName), file.bits);

 

XmlRpcResponse xmlRpcResp = new XmlRpcResponse(new UrlData() { url = $"{imageUrl}{fileName}" });

XmlRpcSerializer serializer = new XmlRpcSerializer();

Stream responseStream = new MemoryStream();

serializer.SerializeResponse(responseStream, xmlRpcResp);

responseStream.Seek(0, SeekOrigin.Begin);

return responseStream;

}

 

}

@@#

 

Under Memorial

 

 

Guess you like

Origin www.cnblogs.com/QinQouShui/p/10939525.html