Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesget DnnFilePicker fileIDget DnnFilePicker fileID
Previous
 
Next
New Post
4/21/2016 4:39 AM
 

Hi everyone, i'm trying to manually update the user profile picture in a custom module (HvProfile in this case).

So far, I put the DNNFilePicker control in my view.ascx, as follows:

 

<dnn:DnnFilePicker id="filepicker1" runat="server"></dnn:DnnFilePicker>

It is working right. Uploads a pic and inserts a new line at "files" SQL table, gives it a route path, a fileID and so on.

To save the "Photo" profile property it's easy from .cs codebehind:

UserInfo myDnnUser = this.UserInfo;

myDnnUser.Profile.SetProfileProperty("Photo", filepicker1.fileID());

However, if i put this code in my view.ascx.cs it loads it sequentially on page load, so it doesn't wait for the user to upload the pic and gets a wrong filepicker1.fileID.

So, to get filepicker1.fileID, i must wait the user to upload the file, i can only call that code after the image is uploaded by the DnnFilePicker control (filepicker1 in my case")

To achieve this, i thought i could run that code calling a webservice, and i created a javascript onclick event which calls that web service when i'm sure the image is uploaded with the control.

Now i have the problem that i can't get the filepicker1.fileID as filepicker1 seems not to be declared in the webservice.

I tried getting it by:

using System.Net.Http;

using System.Web.Http;

using DotNetNuke.Web.Api;

using DotNetNuke.Entities.Users;

using DotNetNuke.Services.FileSystem;

using DotNetNuke.Web.UI.WebControls;

using DotNetNuke.UI.UserControls;

namespace Christoc.Modules.HvProfile.clases

{

    public class PostUserProfileController : DnnApiController

    {

        [AllowAnonymous]

        [HttpPost]

        public HttpResponseMessage changeUserInfo()

        {

            var fp = Christoc.Modules.HvProfile.View.filepicker1;

            UserInfo myDnnUser = UserController.Instance.GetCurrentUserInfo();

            myDnnUser.Profile.SetProfileProperty("Photo", fp.FileID.ToString());

            return null;

        }

    }

}

However var fp returns null and i'm stuck, seems like filepicker1 class, object or whatever it is, is not shared between the view and the webservice, or i might call it wrong.

filepicker1 is defined like this in my view.ascx.designer.cs:

        public static global::DotNetNuke.Web.UI.WebControls.DnnFilePicker filepicker1;

Any help is welcome, bye and thanks.


 
New Post
4/21/2016 12:30 PM
 
Did you try setting the property to "fileid=" & fileID ?

Cheers from Germany,
Sebastian Leupold (Microsoft MVP)

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
4/22/2016 7:45 AM
 
What property do you mean?
Could you give a detailed explanation?
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesget DnnFilePicker fileIDget DnnFilePicker fileID


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out