file upload - Uploading content is only supported for 'http' and 'https' schemes -
i'm trying upload file ftp server, i'm using code :
uri uri; if (!uri.trycreate(serveraddressfield.text.trim(), urikind.absolute, out uri)) { rootpage.notifyuser("invalid uri.", notifytype.errormessage); return; } // verify not snapped, or can unsnap open picker. if (applicationview.value == applicationviewstate.snapped && !applicationview.tryunsnap()) { rootpage.notifyuser("file picker cannot opened in snapped mode. please unsnap first.", notifytype.errormessage); return; } fileopenpicker picker = new fileopenpicker(); picker.filetypefilter.add("*"); storagefile file = await picker.picksinglefileasync(); if (file == null) { rootpage.notifyuser("no file selected.", notifytype.errormessage); return; } passwordcredential pw = new passwordcredential(); pw.password = "pass"; pw.username = "username"; backgrounduploader uploader = new backgrounduploader(); uploader.servercredential = pw; uploader.method = "post"; uploader.setrequestheader("filename", file.name); uploadoperation upload = uploader.createupload(uri, file); log(string.format("uploading {0} {1}, {2}", file.name, uri.absoluteuri, upload.guid)); // attach progress , completion handlers. await handleuploadasync(upload, true);
but sends me exception here : uploadoperation upload = uploader.createupload(uri, file); "an exception of type 'system.argumentexception' occurred in microsoft.samples.networking.backgroundtransfer.exe not handled in user code
winrt information: 'uri': uploading content supported 'http' , 'https' schemes."
your answer right there in exception message.
to quote the documentation:
ftp supported, when conducting download operations.
so can't use backgrounduploader
ftp.
Comments
Post a Comment