Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Publish Image to Umbraco Media Library
WhatsApp
S Ravindran
10y
11.9
k
0
0
25
Blog
public
class
MediaClass
{
public
HttpPostedFileBase
file {
get
;
set
; }
public
string
FileNameAlias {
get
;
set
; }
public
string
NameOfImage {
get
;
set
; }
public
string
ParentMediaName {
get
;
set
; }
}
protected
int
AddImageToUmbraco(
MediaClass
mediaClass)
{
var
ms = Services.MediaService;
var
newFile = ms.CreateMedia(mediaClass.NameOfImage,
uQuery
.GetMediaByName(mediaClass.ParentMediaName).FirstOrDefault().Id,
"Image"
, member.Id);
newFile.SetValue(
"umbracoFile"
, mediaClass.file);
ms.Save(newFile);
return
newFile.Id;
//return the id of newly created image
}
Publish image to umbraco media library
Up Next
Image Conversion And Storing The Image Value Using C#
Ebook Download
View all
Diving Into OOP
Read by 16.1k people
Download Now!
Learn
View all
Membership not found