I am writing a custom usercontrol for Umbraco that will let a user edit their Bio Page. The bio pages are just documents with a 'bio' doctype. The bio doctype has name, address, etc and I've gotten my control to save those values to umbraco using the simple syntax:
Document currentPage = new Document(Node.GetCurrent().Id);
however, now I need to upload an image. So in the bio doctype, I created a 'bioImage' property ... is there an easy way to fill the file upload with the user's file from a Fileupload? is there an umbraco tag that gives you the same file upload as in the Admin portion of umbraco? I have been reading forums for days trying to find it. here's what i have so far, which uploads the file to the server, and changes the media link, but it doesn't have the preview image in the Admin side, nor does it generate a thumbnail or anything. Am I doing this right?
if (BioImageFileUpload.HasFile)
{
var fileName = Server.MapPath("~/media/" + currentPage.getProperty("bioImage").Id.ToString() + "/" + BioImageFileUpload.FileName);
Very Newbie Question, file upload
I am writing a custom usercontrol for Umbraco that will let a user edit their Bio Page. The bio pages are just documents with a 'bio' doctype. The bio doctype has name, address, etc and I've gotten my control to save those values to umbraco using the simple syntax:
Document currentPage = new Document(Node.GetCurrent().Id);
currentPage.getProperty("jobTitle").Value = JobTitleTextBox.Text;
however, now I need to upload an image. So in the bio doctype, I created a 'bioImage' property ... is there an easy way to fill the file upload with the user's file from a Fileupload? is there an umbraco tag that gives you the same file upload as in the Admin portion of umbraco? I have been reading forums for days trying to find it. here's what i have so far, which uploads the file to the server, and changes the media link, but it doesn't have the preview image in the Admin side, nor does it generate a thumbnail or anything. Am I doing this right?
if (BioImageFileUpload.HasFile)
{
var fileName = Server.MapPath("~/media/" + currentPage.getProperty("bioImage").Id.ToString() + "/" + BioImageFileUpload.FileName);
Trace.Write(fileName);
BioImage.ImageUrl = "media/" + currentPage.getProperty("bioImage").Id.ToString() + "/" + BioImageFileUpload.FileName;
if(!Directory.Exists(Server.MapPath("~/media/"+currentPage.getProperty("bioImage").Id.ToString())))
{
Directory.CreateDirectory(Server.MapPath("~/media/" + currentPage.getProperty("bioImage").Id.ToString()));
}
BioImageFileUpload.SaveAs(fileName);
currentPage.getProperty("bioImage").Value = BioImage.ImageUrl;
}
is working on a reply...