Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I need an upload field for a contact form that will both save an image to a folder (in the media section or otherwise) and generate a file path that could be inserted into the contact email that editors/admins receive.
Using this guide, I was able to set up the file upload section and successfully receive the name of the file rendered as a string, but it leaves out any code that would actually upload the file to a folder, assuming the developer would already know that information. I do not know that information.
public void CreateMedia(HttpPostedFileBase postedFile)
// Folder where you want to store the media item.
var parentMediaFolder = Services.MediaService.GetById(1234);
// Create a media item
var node = Services.MediaService.CreateMediaWithIdentity(postedFile.FileName, parentMediaFolder, "Image");
//Assign your file to the Media node. To get this SetValue extension you have to use the Umbraco.Core.Models namespace.
//Save you node values
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted