This is a migrated thread and some comments may be shown as answers.

display image after upload

5 Answers 342 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Ted
Top achievements
Rank 1
Ted asked on 26 Jul 2010, 01:52 AM
I am trying to get a simple AsyncUpload to show the image after it's uploaded to the temporary folder.  is there a way to do this and do you have any examples of this?
I am using the Q2 2010 version

I'm using this
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Thumbnail" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingExamplePanel">
    </telerik:RadAjaxLoadingPanel>
    <span class="info"></span>
    <div class="imageContainer">        
        <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Skin="Forest" TargetFolder="~/images/Boats" 
            OnClientFileUploaded="fileUploaded" OnClientDeleting="clientDeleting"
            onfileuploaded="RadAsyncUpload1_FileUploaded1">
        </telerik:RadAsyncUpload>   

        <telerik:RadBinaryImage ID="Thumbnail" runat="server" />




and











 protected void RadAsyncUpload1_FileUploaded1(object sender, FileUploadedEventArgs e)
        {
            Stream fileStream = e.File.InputStream;           
            byte[] imageData = new byte[e.File.InputStream.Length];
            fileStream.Read(imageData, 0, (int)e.File.InputStream.Length);
            Thumbnail.DataValue = imageData;            
            fileStream.Close();
        }

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 26 Jul 2010, 11:35 AM
Hi Ted,

Please check this online example which demonstrates similar approach.

All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ted
Top achievements
Rank 1
answered on 26 Jul 2010, 12:56 PM
I saw that demo and started with it.  my issue is instead of adding an image control or clearing it I want to update an existing image control.  And I don't want to use a database but simply show the file that is uploaded to the temp directory.
0
Yana
Telerik team
answered on 29 Jul 2010, 11:30 AM
Hi Ted,

I've attached a simple page to demonstrate how to achieve the needed approach, please download it and give it a try.

All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 25 Apr 2014, 09:09 AM
Thank you yana this works very good.
Could you look how to integrate a AjaxLoadingpanel into this example.
I can't get this right to work...

Marc
0
Boyan Dimitrov
Telerik team
answered on 29 Apr 2014, 01:12 PM
Hello,

Please try the following approach:

//markup code
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Thumbnail" LoadingPanelID="LoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Width="256px" Height="64px" MinDisplayTime="2000">
    <asp:Label ID="Label2" runat="server" ForeColor="Red">Loading... </asp:Label>
</telerik:RadAjaxLoadingPanel>
<span class="info"></span>
<div class="imageContainer">
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" TargetFolder="~/images/Boats"
        OnClientFileUploaded="flieUploaded">
    </telerik:RadAsyncUpload>
 
    <telerik:RadBinaryImage ID="Thumbnail" runat="server" />
</div>



Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
AsyncUpload
Asked by
Ted
Top achievements
Rank 1
Answers by
Yana
Telerik team
Ted
Top achievements
Rank 1
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Boyan Dimitrov
Telerik team
Share this question
or