CustomModule asp:FileUpload

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/21/2010 7:54:51 AM
Gravatar
Total Posts 7

CustomModule asp:FileUpload

Hi,

I wrote a simple module, and wanted to use a standard asp:FileUpload control.

My code for save image action is very simple, but does not work with my .ascx control file.

But if I create test.aspx page and put there the same code for save image action It works correctly.

So my question is how to use asp:FileUpload in my module .ascx file.

Please help.

Best,

Marcin

7/21/2010 8:26:03 AM
Gravatar
Total Posts 18439

Re: CustomModule asp:FileUpload

As far as I know there should be no difference using <asp:FileUpload in a UserControl vs a Page. Maybe you don't have the events wired up correctly in the usercontrol. Best to set a break point and step through your code and see what is happening and if events are firing as expected.

You might want to consider using NeatUpload as we do in existing features, you could study the code for Shared Files or  ImageGallery for examples of uploading files.

Hope it helps,

Joe

7/23/2010 6:13:00 AM
Gravatar
Total Posts 7

Re: CustomModule asp:FileUpload

Hi,

I tried to run it but it still does not work :)

I'm a beginner in ASP so maybe You can help me because I don't know what to do with this.

So my code for test is :

in .ascx

<asp:FileUpload ID="UploadFoto" runat="server"/>
<asp:Button ID="Button3" runat="server" text="Zapisz" OnClick="SavePolecamyFoto"/>

in .ascx.cs

protected void SavePolecamyFoto(object sender, EventArgs e)
    {
        if (UploadFoto.HasFile)
        {
            UploadFoto.SaveAs(Server.MapPath("~/orginalne.jpg"));
        }
    }

 

As discussed earlier the same code is working properly with .aspx page, but in my .ascx file which is a module (modeled on tutorial http://www.mojoportal.com/hello-world-developer-quick-start.aspx) don't.

Best,

Marcin

7/23/2010 7:45:30 AM
Gravatar
Total Posts 18439

Re: CustomModule asp:FileUpload

Hi Marcin,

The hello world examples use an ajax UpdatePanel, unfortunately FileUpload will not work inside an UpdatePanel, so you should remove the updatepanel so it can do a full postback.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.