Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kiran 17 posts 109 karma points
    Mar 26, 2021 @ 05:12
    Kiran
    0

    Value not saving in file upload custom property

    Hey there, As our requirement we need to allow only pdf files in file upload so we decided to create file upload custom property. we created custom property but value is not saving Below is the my package.manifest code.

      {
      "propertyEditors": [
        {
          "alias": "UploadPdfFile",
          "name": "PdfFileUpload",
          "editor": {
            "view": "~/App_Plugins/UploadOnlyPdfFile/PdfFileUpload.html"
          }
        }
      ],
      "javascript": [
        "~/App_Plugins/UploadOnlyPdfFile/UploadOnlyPdfFileController.controller.js"
      ],
      "css": [
        "~/App_Plugins/UploadOnlyPdfFile/Pdffiles.css"
      ]
    }
    

    Could you please somebody help me.

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Mar 26, 2021 @ 19:51
    Alex Skrypnyk
    1

    Hi Kiran

    Upload logic is in js and serverside, we are not able to track the problem by this package.manifest file

    Alex

  • Kiran 17 posts 109 karma points
    Mar 29, 2021 @ 05:01
    Kiran
    0

    Hi Alex, i am building logic in js below is my html and js code.

    Html Code

    <div ng-controller="UploadOnlyPdfFileController as vm">
        <input type="file" name="vm.restaurantmenu" ng-change="FileValidation()" ng-model="vm.restaurantmenu" accept="application/pdf" />
    </div>
    

    Js Code

    angular.module("umbraco")
        .controller("UploadOnlyPdfFileController",
            function ($scope) {
                var vm = this;
                vm.restaurantmenu = "";
            $scope.FileValidation = function () {
                //var filename = $(this).val();
                //alert(vm.restaurantmenu);
                console.log(vm.restaurantmenu);
                //var ext = filename.split('.').pop().toLowerCase();
                //if ($.inArray(ext, ['pdf']) == -1) {
                //    alert('Please upload only pdf file.');
                //    return false;
                //}
            }
        });
    
  • Lewis 1 post 71 karma points
    Mar 27, 2021 @ 11:28
    Lewis
    0

    Have you checked the browsers console log to see if it provides some error information when you're loading and saving the document type where the property editor is being used? I have seen JavaScript be less than happy about dealing with stuff that contains "-" in the names. So perhaps try renaming to preTreatment by using camel casing as you're also doing in other name as well so it looks like.

Please Sign in or register to post replies

Write your reply to:

Draft