Advertisement
LoonerSF

Bad Code Creating a Photo ACS kept for later reference

Aug 24th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.40 KB | None | 0 0
  1. /*//String file = "file=@" + Application.StartupPath + "\\tmp.jpg";
  2.  
  3.                         url = "https://api.cloud.appcelerator.com/v1/photos/create.json?key=esfob3KF1R2zBRh8vroMQCCMlQCP44xx&_session_id=" + session;
  4.                         wrGetUrl = (HttpWebRequest)WebRequest.Create(url);
  5.  
  6.                         NameValueCollection nvc = new NameValueCollection();
  7.                         HttpUploadFile(url, Application.StartupPath + "\\tmp.jpg", "file", "image/jpeg", nvc);
  8.  
  9.                         //String boundary = "B0unD-Ary";
  10.                         string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");
  11.                         wrGetUrl.ContentType = "multipart/form-data; boundary=" + boundary;
  12.                         wrGetUrl.Method = "POST";
  13.  
  14.                        
  15.  
  16.                         //String postData = "--" + boundary + "\nContent-Disposition: form-data\n\n";
  17.                         //postData += "myId=123&someFk=456";
  18.                         //postData += "\n--" + boundary + "\nContent-Disposition: form-data; name=\"file\" filename=\"" + Application.StartupPath + "\\tmp.jpg" + "\"\nContent-Type: image/jpeg\n\n";
  19.                         //byteArray = Encoding.UTF8.GetBytes(postData);
  20.  
  21.                         //byte[] filedata = null;
  22.                         //using (BinaryReader readerr = new BinaryReader(File.OpenRead(Application.StartupPath + "\\tmp.jpg")))
  23.                         //    filedata = readerr.ReadBytes((int)readerr.BaseStream.Length);
  24.  
  25.                         //wrGetUrl.ContentLength = byteArray.Length + filedata.Length;
  26.                         //wrGetUrl.GetRequestStream().Write(byteArray, 0, byteArray.Length);
  27.                         //wrGetUrl.GetRequestStream().Write(filedata, 0, filedata.Length);
  28.  
  29.                         //wrGetUrl.ContentLength = file.Length;
  30.                        
  31.  
  32.                         //byteArray = Encoding.ASCII.GetBytes(file);
  33.  
  34.                        
  35.                         objStream = wrGetUrl.GetResponse().GetResponseStream();
  36.                         reader = new StreamReader(objStream);
  37.  
  38.                         line = reader.ReadToEnd();
  39.                         jo = JObject.Parse(line);
  40.  
  41.                         meta = jo.SelectToken("meta").ToString();
  42.                         jo = JObject.Parse(meta);
  43.                         status = jo.SelectToken("status").ToString();*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement