Hi,
In my View, Im trying to get the ID of the file that is uploaded with Umbraco.UploadField.
I can easily get the url of the file with code :
var TFile = CurrentPage.SingleTenderFile;
But i really can't find a way to get the ID of file.
I also tried :
@if (CurrentPage.SingleTenderFile != null && !(CurrentPage.SingleTenderFile is Umbraco.Core.Dynamics.DynamicNull))
{
var m = Umbraco.Media(CurrentPage.SingleTenderFile);
@m.Id
}
But gives m.Id = 0
Is there any other code I can use to get the id?
Im using 7.4
You can't get Id if you are using Umbraco.UploadField. Try to use Media Picker or ImageCropper, then you will have media item for each uploaded file and Id.
Get ID of single uploaded file
Hi, In my View, Im trying to get the ID of the file that is uploaded with Umbraco.UploadField.
I can easily get the url of the file with code :
But i really can't find a way to get the ID of file.
I also tried :
But gives m.Id = 0 Is there any other code I can use to get the id? Im using 7.4
Regards George
Hi George
You can't get Id if you are using Umbraco.UploadField. Try to use Media Picker or ImageCropper, then you will have media item for each uploaded file and Id.
Thanks,
Alex
Hi Alex, thank you for the reply. I will replace uploadfield with media picker.
Regards George
is working on a reply...