private List <string> GetFilesToTransfer(string ipAddress, string xmlPath) { try { NameValueCollection nvc = new NameValueCollection(); string filesToTransferXML = HTTPPost.HttpUploadFile("http://" + ipAddress + "/GetFilesToTransfer", xmlPath, "filesInSite.xml", nvc); if (filesToTransferXML != "404") { if (!String.IsNullOrEmpty(filesToTransferXML)) { return(ParseFilesToTransferXml(filesToTransferXML)); } } else { Trace.WriteLine("404 received - no files to transfer"); } } catch (Exception ex) { Trace.WriteLine("Exception in GetFilesToTransfer: " + ex.ToString()); MessageBox.Show(ex.ToString()); } return(null); }
private static bool UploadFileToServer(string id, string filePath) { string fileName = System.IO.Path.GetFileName(filePath); LogMessage(GetTimeStamp() + " : UploadFileToServer: id=" + id.ToString() + ", filePath=" + filePath + ", fileName=" + fileName); NameValueCollection nvc = new NameValueCollection(); nvc.Add("Destination-Filename", String.Concat("content/", fileName)); nvc.Add("Friendly-Filename", fileName); nvc.Add("DB-Id", id); try { string responseString = HTTPPost.HttpUploadFile("http://" + _bsIPAddress + "/TranscodedFile", filePath, fileName, nvc); if (responseString != "RECEIVED") { LogMessage(GetTimeStamp() + " : UploadFileToServer: HTTPPost returned " + responseString); return(false); } } catch (Exception ex) { LogMessage("Exception in HTTPPost: " + ex.ToString()); return(false); } LogMessage(GetTimeStamp() + " : UploadFileToServer: success"); return(true); }
private bool UploadFileToBrightSign(string sourcePath, string destinationRelativePath, string ipAddress) { Trace.WriteLine("UploadFileToBrightSign: " + sourcePath); //string encodedFileName = HttpUtility.UrlEncode(fileName); try { NameValueCollection nvc = new NameValueCollection(); nvc.Add("Destination-Filename", destinationRelativePath); HTTPPost.HttpUploadFile("http://" + ipAddress + "/UploadFile", sourcePath, destinationRelativePath, nvc); return(true); } catch (Exception ex) { Trace.WriteLine("Exception in UploadFileToBrightSign: " + ex.ToString()); MessageBox.Show("Exception in UploadFileToBrightSign"); } return(false); }