https://gist.github.com/PepeuCps/7695713
Do lado do servidor eu faço o seguinte:
[HttpPost]
public JsonResult fileUpload(HttpPostedFileBase uploadedfile)
{
logger.Info("fileUpload");
try
{
if (uploadedfile != null && uploadedfile.ContentLength > 0)
{
uploadedfile.SaveAs(Server.MapPath("~/Content/Uploads/") + Path.GetFileName(uploadedfile.FileName));
}
return Json(1, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
logger.Error("fileUpload ERROR : " + ex.Message + " [ " + ex.InnerException.StackTrace + "]");
return Json(0, JsonRequestBehavior.AllowGet);
}
}
Espero que ajude!
Abraços,
Pedro Subutzki
__________________________________________
Pedro Subutzki
__________________________________________
HADI - Makes SQLite in Android easy and simple
https://github.com/PepeuCps/Hadi
https://github.com/PepeuCps/Hadi
2014-04-24 18:31 GMT-03:00 Alexandre Freitas Duarte <alexfd7@gmail.com>:
--Ola pessoal, uma dúvida, quero mandar a imagem da câmera do meu dispositivo pro meu webservice em C#.Net, em relação de vocês ao código:
eu posso mandar a variável "stream" pro webservice e ele converter para JPEG ?? Qual a maneira mais correta e rapido de enviar a imagem?Bitmap bmp = (Bitmap) intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();bmp.compress(Bitmap.CompressFormat.JPEG, 100, stream);byte[] byteArray = stream.toByteArray();this.savePicture(byteArray);
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.






0 comentários:
Postar um comentário