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

RadAsyncUpload

3 Answers 122 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 07 Dec 2012, 05:28 PM
I have a question about functionality of this control.

Here is my scenario: I have an ASPX page with a RadWindow that has a ContentTemplate that appears from clicking a button. Nothing complicated, the button just does this

OnClientClick="openUploadWindow1(); return false;

Inside of the RadWindow that opens I have (among other controls) a RadAsyncUpload control that automatically uploads a file to the default temporary directoy and a DIV that contains the image of a file that is saved to a database. What I'm trying to do is the following:

Someone uploads a TIFF image through the RadAsyncUpload tool. I would like to display this image in the aforementioned DIV as soon as the image is finished uploading to the temporary directory. However, TIFFs can't be viewed normally in a browser, so I would need to post-back to the server to convert it to a JPG, PNG, or BMP and then display that image. However, I don't see a method that handles this scenario.

In brief I want to:
  • Open a RadWindow
  • Select a file that is immediately uploaded via RadAsyncUpload in that RadWindow
  • As soon as it's finished, call some server-side function or at least post-back to the server
  • Convert the image to a JPG
  • Re-open the dialog box with the controls on my RadWindow with the same information

This since it's posting back it sounds like more a job for RadUpload, but there's most likely functionality in RadAsyncUpload that I don't know about.

Thank you for your time.

3 Answers, 1 is accepted

Sort by
0
Kyle
Top achievements
Rank 1
answered on 07 Dec 2012, 08:51 PM
Actually, what I ended up doing was the following:

Added 
OnClientFileUploaded="uploadPostBack1"

to the RadAsyncUpload control in the ASPX file.

Added this in my Javascript:

function uploadPostBack1() {
    "use strict";
    var uploadName = document.getElementById('<%=DialogTextBox1.ClientID%>').value;
    __doPostBack("Upload1", uploadName);
 }


From here I could just call 

UploadWindow1.VisibleOnPageLoad = true;

from the Page_Load event after I ran my own code to get the image. If you happen to run this in the Page_Load however, take note that any postback could cause the  window to keep re-appearing so set the above to false first, run your desired code, and if you need the window then do the VisibleOnPageLoad = true again.


Hopefully this helps someone out. I'll be watching the thread just in case someone wants to do something similar.
0
Kyle
Top achievements
Rank 1
answered on 11 Dec 2012, 05:00 PM
Well, turns out it's still not quite working how I would like...
---

Here is my updated situation. I have a RadWindow with a RadAsyncUpload control inside of it. The RadWindow is using an actual ASPX page, not a template. When the user uploads a file, it is set to immediately reload the radWindow because the file the user uploads will be a TIF and I need to create a JPG copy of it server side and then display that image (but keep copies of them both to store in a database when I hit a save button)  but I can't access the files from the radasyncupload control in the code-behind after I reload the radwindow as the count of uploaded files is 0.

I tried the PostBackTriggers, but that didn't seem to do anything for me.
Any ideas? Thanks in advance.


Code for reloading the RadWindow:
<script type="text/javascript">
            /*global getRadWindow, uploadPostBack1 */
 
            function getRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
 
            function uploadPostBack1() {
                var thisWindow = getRadWindow();
                thisWindow.reload();
            }
        </script>


0
Kyle
Top achievements
Rank 1
answered on 12 Dec 2012, 08:59 PM
Bah, I figured it out. I wish I could delete my thread.
Tags
AsyncUpload
Asked by
Kyle
Top achievements
Rank 1
Answers by
Kyle
Top achievements
Rank 1
Share this question
or