We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to assign users to Role and upload file with custom attributes?

Thread ID:

Created:

Updated:

Platform:

Replies:

151112 Jan 31,2020 08:12 AM UTC Feb 13,2020 09:47 AM UTC ASP.NET MVC - EJ 2 9
loading
Tags: FileManager
Unknown
Asked On January 31, 2020 08:13 AM UTC

1.we want to take few inputs from the user like expiry date for the document, status(draft/published) and owner of the document for that file being uploaded. And we wish to display this information in details view on file load event. is it possible?

Could you please provide a MVC sample with SQL database for the above requirement

2.can we customize search, we are tying to display results based on some tags  instead of file name only.

3. how to add users to Roles for administration

4. is it possible to upload a file one folder and reference it in other places

Thanks in advance



Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On February 3, 2020 12:25 PM UTC

Hi Mahesh, 
 
Greetings from Syncfusion support. 
 
Query 1 & Query 2  -  Custom attribute and custom search 
 
We have  checked your reported query. We will consider this as a custom sample from our end. We will update the sample within 3 business days. 
 
Query 3 – Access control for SQL database. 
 
Currently, we have not provided access control support for SQL file provider. It will only available in our physical file provider. However, we might consider this as a feature from our end. It will be included in any one of our upcoming release. Please be patience, until then. 
 
Track the below link for feature status. 
 
Query 4 -  is it possible to upload a file one folder and reference it in other places 
 
We are not clear about your exact requirement. We suspect that your requirement is to upload the files in one particular location( physical location). Store the file reference in SQL database. Access the files based on reference stored in database.  
 
If this is not your requirement, can you please share your exact requirement. It will helpful for us to resolve your issue at earlier. 
 
Please let us know, if you need any further assistance on this. 
 
 
Regards,  
Shameer Ali Baig S. 


Unknown
Replied On February 3, 2020 12:49 PM UTC

Thank you Sameer.

We can use Mysql database(Maria DB) instead Microsoft SQL server right?  We don't find any SQL file provider sample with MVC(except .net core) on your site. Please share a link if you have  any.

Query 4-

Assume we uploaded a file named sample.txt in FolderA. we are trying to give clickable links(anchir tag) from other folders(B,C,D) as well to access sample.txt file.
like we have option in sharepoint to reference files and it these files should appear in filter results as well from all locations


Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On February 4, 2020 05:22 AM UTC

Hi Mahesh, 
 
Currently, we have not provided support for SQL file provider service for ASP.NET MVC platform. But you can use our ASP.NET Core based SQL file provider by hosting it and refer the service URL in your MVC application. We have prepared a simple sample with FileManager based on this solution. Refer the below sample link. 
 
Service link: 
 
 
Please, download the service and launch the application. After that, run the below application (ASP.NET MVC) in which we have referred the service links from the hosted ASP.NET Core SQL file provider application. 
 
Sample link: 
 
 
Please let us know, if it is convenient for your requirement. On your confirmation, we will prepare a sample with customization for search and adding additional attributes in File Manager and update it to you. 
 
Please let us know, if you have any concerns. 
 
Regards,  
Shameer Ali Baig S. 


Unknown
Replied On February 4, 2020 07:55 AM UTC

We are good to proceed with this approach, could you please confirm whether we can Mysql database or not?

we are expecting to store 3 to 5K documents(20GB size). we believe File Manager control is capable of serving our requirement in terms of performance etc.

Thank you.

Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On February 4, 2020 09:10 AM UTC

Hi Mahesh, 
  
Thanks for the update. 
  
We offered Microsoft SQL with File Manager support but didn't provide mySQL server support. EJ2 File Manager can manage 5 K records with the optimum time minimum. 
  
We will provide you the custom sample as promised in our previous update with Microsoft SQL service support. 
  
Please, let us know if you have any concerns. 
  
Regards, 
Shameer Ali Baig S. 


Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On February 7, 2020 06:21 AM UTC

Hi Mahesh, 
 
Thanks for the patience. 
 
As promised, we have prepared a sample for perform filter search based on custom attributes. In our prepared sample, filter search will be based customField property which we added specifically for this customization in FileManagerDirectoryParams class. In this customized sample, when you give input true, then files available within the corresponding folder will be filter and displayed. If you give input as true, then nested folders within the corresponding folder will be filter and displayed. We have added a custom argument in the search action method, for receiving the user input from client-side and to result the filter result from the server-side. 
 
 
 
 
case "search": 
                    if (args.CustomField.ToLower() =="true") 
                    { 
                        args.CustomField = "1"; 
                    } 
                    else 
                    { 
                        args.CustomField = "0"; 
                    } 
                    // gets the list of file(s) or folder(s) from a given path based on the searched key string. 
                    return operation.ToCamelCase(operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive,args.CustomField, args.Data)); 
 
 
We have customized the search method by changing the filter query based on the customField attribute. 
 
string searchQuery = "select * from " + this.TableName + " where isFile= " + customField; 
                    SqlCommand searchcmd = new SqlCommand(searchQuery, sqlConnection); 
                    SqlDataReader reader = searchcmd.ExecuteReader(); 
                   // SqlDataReader reader = (new SqlCommand("select * from " + this.TableName + " where Size like 30 "), sqlConnection).ExecuteReader(); 
                    while (reader.Read()) 
                    { 
                        searchData = new FileManagerDirectoryContent 
                        { 
                            Name = reader["Name"].ToString().Trim(), 
                            Size = (long)reader["Size"], 
                            IsFile = (bool)reader["IsFile"], 
                            DateModified = (DateTime)reader["DateModified"], 
                            DateCreated = (DateTime)reader["DateCreated"], 
                            Type = GetDefaultExtension(reader["MimeType"].ToString()), 
                            HasChild = (bool)reader["HasChild"], 
                            Id = reader["ItemId"].ToString().Trim() 
                        }; 
                        if (searchData.Name != "Products") foundFiles.Add(searchData); 
                    } 
                    reader.Close(); 
                    foreach (var file in foundFiles) 
                    { 
                        file.FilterPath = GetFilterPath(file.Id); 
                        file.FilterId = GetFilterId(file.Id); 
                    } 
                } 
                searchResponse.Files = (IEnumerable<FileManagerDirectoryContent>)foundFiles; 
                return searchResponse; 
 
Please, download the attached service application and run the application.  
 
 
After running the application, please check the below sample to check the customization done for your expected requirement. 
 
 
 
Please, let us know if you need any further assistance. 
 
Regards, 
Shameer Ali Baig S. 


Unknown
Replied On February 10, 2020 04:17 PM UTC

Hi Shameer,

Thanks for custom sample. i don't find any logic to send custom data(e.g. author name, date of expiry) while uploading so that i can save this data in database

On custom search we are not getting the results when i search with author name column value.

we don't understand the custom argument logic as well, how it will work and IsFile column is taking true or false. how it will serve our purpose of filtering files with meta data we upload


Please find the uploaded document for our requirement


Attachment: Book1_b860160f.zip

Sowmiya Padmanaban [Syncfusion]
Replied On February 11, 2020 09:16 AM UTC

Hi Mahesh,  
 
We have checked your exact requirement, additional custom attribute is added to the uploaded files and perform the search operation based on added attribute. We will consider this as a custom sample from our end. We will update the sample within 2 business days (13/2/2020).  
 
Please let us know, if you need any further assistance on this. 
 
 
Regards,  
Sowmiya.P 


Sowmiya Padmanaban [Syncfusion]
Replied On February 13, 2020 09:47 AM UTC

Hi Mahesh,  
 
As promised, we have prepared a custom sample based on your requirement. In this sample, we have added a ReviewNumber as a custom field and perform the search operation based on the custom field. 
 
While uploading you can send the custom field in beforeSend() event and add the field in uploadQuery() method. Refer the below code snippet. 
 
[Js]     
function beforeSend(args) { 
        if (args.action == "Upload") { 
            var data = JSON.parse(args.ajaxSettings.data); 
            // Add custom parameter column  
            data.push({ reviewNumber: "1" }); 
            // Add custom parameter in ajax settings  
            args.ajaxSettings.data = JSON.stringify(data); 
        } 
    } 
 
[C#] 
public void UploadQuery(string filename, string contentType, byte[] bytes, string parentId, string reviewNumber) 
        { 
command.Parameters.Add(new SqlParameter("@ReviewNumber", reviewNumber)); 
} 
 
If you want to perform the search based on custom attaribute, you can override the search operation in server side and perform the search based on custom attribute. 
 
public object FileOperations([FromBody] FileManagerDirectoryContent args) 
        {   
        switch (args.Action) 
            { 
                case "search": 
                    return this.search(args); 
            } 
            return null; 
        } 
public object search(FileManagerDirectoryContent args) 
        { 
            FileResponse readResponse = new FileResponse(); 
            try 
            { 
                // In the below serach operation you can perform the search based on review number 
                var value = this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive, args.Data); 
                 // Tn the below class, you can add the review number as a additional attribute. 
                DirectoryContent cwd = new DirectoryContent(); 
            } 
} 
 
// New property ReviewNumber is added to DirectoryContent class to perform this customization 
public class DirectoryContent 
    { 
        public string ReviewNumber { get; set; } 
 
        public string Path { get; set; } 
    } 
 
public FileManagerResponse Search(string path, string searchString, bool showHiddenItems, bool caseSensitive, params FileManagerDirectoryContent[] data) 
        { 
         // Search the item based on Review number 
         SqlDataReader reader = (new SqlCommand("select * from " + this.TableName + " where ReviewNumber like '" + searchString.Replace("*", "%") + "' AND ItemID IN(" + string.Join(", ", availableFiles.Select(f => "'" + f + "'")) + ")", sqlConnection)).ExecuteReader(); 
                    while (reader.Read()) 
                    { 
                        searchData = new FileManagerDirectoryContent 
                        { 
                           // Add the review number field in serach data. 
                            ReviewNumber = reader["ReviewNumber"].ToString(), 
                            Id = reader["ItemId"].ToString().Trim() 
                        }; 
                         
                    }      
} 
 
If you want to display the reviewNumber column in DetailsView, you can override the getFiles method. We have considered this requirement too in the below attached sample. 
 
 
Note: It is mandatory to add the custom field in SQL Tables. 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon