London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Unable to upload video files

Vote:
 

Hello.

I'm having trouble uploading video files.

Has the following code:

    [ContentType(GUID = "1f7218e9-bddf-4734-b067-4d2d68b5dade")]
    [MediaDescriptor(ExtensionString = "mp4,webm,ogg,mov")]
    public class VideoMediaData : VideoData
    {
        [CultureSpecific]
        [Display(
            Name = "Name",
            Description = "Name of the video file",
            Order = 10)]
        public virtual string VideoName { get; set; }
    }

Have no problems uploading images and for example PDF files with similar solution.

Error messages I get when uploading video files are:
Object reference not set to an instance of an object.

Any thoughts on why it doesn't work and maybe some suggestion on some solution I can try?

#223114
May 19, 2020 8:51
Vote:
 

It might have something to do with the size of the video, by default only 4MB files can be accepted by ASP.NET. Can you get the full error message/stacktrace ?

#223117
May 19, 2020 12:28
Vote:
 

I use two video files for testing, one .mp4 file that has 375 kb in size, the other file is a .webm of 2.07 mb.
Same error for both files.

Can upload images larger than 4 mb without problems.

If I check the network tab in Chrome Developer Tools, I get this JSON response:

[{"index":0,"fileName":"small.mp4","errorMessage":"Object reference not set to an instance of an object.","contentLink":null}]

Nothing is logged in the log file.

No stack trace, 

Error message appears in the file upload box, so it will not be a total crash of site.

Cannot share link to an image for any reason.

#223118
Edited, May 19, 2020 12:38
Vote:
 

I used same code in the Alloy demo site it works fine for me and able to upload more than 4MB size file. You can try with below settings.

 
 <system.webServer>
    <security>
      <requestFiltering>      
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>
  </system.webServer>

  <location path="EPiServer">
    <system.web>
      <httpRuntime maxRequestLength="1048576" requestValidationMode="2.0" executionTimeout="7200" />
    </system.web>
  </location>
#223131
May 19, 2020 18:46
Vote:
 

Hi Ompa

Are you able to see your VideoMediaData inside "Media Type" in CMS->Admin->Content Type?

Can you try renaming this "VideoMediaData" class with some other name and give a try?

#223151
Edited, May 20, 2020 6:37
Vote:
 

Hello.

Have added these lines to Web.config, but it remains the same problem.

I have created an empty CMS site and there is also a Commerce installed. Installed according to the documentation.
So is it something I miss, something that Alloy comes with but that doesn't come with an empty CMS installation?
I see VideoMediaData under MediaTypes. The other media types are also there.

#223152
May 20, 2020 7:01
Ravindra S. Rathore - May 20, 2020 7:07
Can you try renaming this "VideoMediaData" class with some other name and give a try?
Vote:
 

Hi.

Deleted the class completely, created it again with a new name, and now it works.

Thank you all for your help!

#223154
May 20, 2020 7:34
Ravindra S. Rathore - May 20, 2020 7:40
Great !!! I also updated my above comment answer in a thread
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.