我正在开发移动app.Trying上传图像表单sdcard,但是有一个错误声明" java.net格式错误的网址异常协议未找到"。
WWW localFile = new WWW("file://" + localFileName);
yield return localFile;
if (localFile.error == null)
TraceTxt.text = TraceTxt.text+ "\nLoaded file successfully";
else
{
TraceTxt.text = TraceTxt.text+ "\nOpen file error: "+localFile.error;
yield break; // stop the coroutine here
}
WWWForm postForm = new WWWForm();![enter image description here][2]
postForm.AddBinaryData ("file", localFile.bytes, "file://"+localFileName, "image/png");
WWW upload = new WWW(uploadURL,postForm);
yield return upload;
if (upload.error == null)
TraceTxt.text =TraceTxt.text+ "\nupload done :" + upload.text;
else
TraceTxt.text = TraceTxt.text+ "\nError during upload: " + upload.error;
图像让您清楚地了解错误。 干杯:)
答案 0 :(得分:0)
您的文件路径格式不正确,请将其打印到控制台或设置断点以调查完整路径。