This is a migrated thread and some comments may be shown as answers.
RadAsyncUpload Demo
20 Answers 843 Views
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 02 Jun 2010, 09:22 PM
I really like the look and feel of the RadAsyncUpload, but I can't seem to figure out how to use it.  None of the demos show how to do a simple save file.  I can get my code to save the temp file to the App_Code/RadUploadTemp folder, but I can't figure out how to access that file and rename/save it to it's actual location.  I've been trying to use the UploadedFileInfo.TempFileName method, but I get an unreadable string returned.

Any demos or help would be greatly appreciated!

20 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 02 Jun 2010, 09:27 PM
This is what I get when I try to use the UploadedFileInfo.TempFileName method:

��������`I�%&/m�{J�J��t��`$ؐ@�����iG#)�*��eVe]f@�흼 ��{���{��;�N'���?\fdl��J�ɞ!���?~|?"��Ey�')=��y6����h�����O��6���Η�<]Vm��m�Vi�L�e�f�:ǟ�?�+/{К�:� �T����W�v�<[��~2�g�2��?�ʋ�y�hYՋ������t� _N���M�l�����{��,��Xn���Q�}�����*g�������7�� ~�`�j'u>K�{_�IW�2��������,KO�eS��יy�/���m^+�E eB��c*�j�w��,�Vu���q�2? @]�uC_��X_����E^��d�Tm[-��;�w�v�V�r�MJ Y��y���uYP祐���2�����uC� ԡO��w}V|W�J�d��\0��>��m���ւh����=z��4��GV,ӏ�~��Ve1elǏ�uzU���g�;;�{�Y�lW��)Jz���]���a�w�>.��tG��fL{�A��<��}t\Y9J��2-�=J?ϗ�%�|�^�Ζ���b]f�(m�W���y���(}�7ӺX �<�;9:^��%f�$Y��Ms�.��49�ٺ.�i;���|��o��nBh^��/Z�M;N_�y����e�_q3"��m��4b�:]T$��R��I�n� �%�&���hզU]/f-�B���V�|���?6�S;��y�e#C}ݴ�b�b]����٦�ү7��h���55gF|���qnY�<�������L��\� ~��ȟ�&��Hy���d6}x��~��&�4�����9nүVe����3�}�L��o���d��@ <� �7���l�:�ݏ���|�-���u�L.���}@��.�3(�Z�^Pc����0���.��;�򐍏� }ڝI��8�+�a����ɣ��,HX�ߗ&����~�ϊ��D���� |2�V��7�- ���۴$���k��f�iی�f�n|9A/�p9iV��o�qk_4O���׬ �@7�S&���s��tZ�����T��ʿH�م����j5#�wR-���׆'�  A]���K����I�;Д��?2��&/��7'�?�P����c}'�����W� ��_.��'4� �;�`��� �3$U� �<���JX4�`����O��tV�D���y�=|�`�ev� ��U�>!�`g��f+_+lŀ� Q~��^�O�h�`�#�i�4����˭'����r=�I�/��INL�7���˪X��4����k� ]?<؁��9R�7;�E��[ü�_� M��Ŵ���M�/Nߤ�j�;WU�6���w��w�=��t��az��%�������׿�$�"߅�|jt��w��N ���6e��T���S�Q|�^���J���F4Ɔ�}=���϶:���ϲ6#��vۮ�21�/t..A@u��ӏ=�}�^e �Auu���P���-�����p(q˞�z}���0y�d�}��W���<[���ջ��� ?eq���r����_��j�ᝳ��*�蠻�j[�����>_ى�4�Ū�)TM�']V림�>������ ���+�l�@n�O�Fg�mq�&�4[SN�E�@/�kd(�B5��*%�<��CX�� ��Ў¹�fd�"�PbF��/��?���n�ɸ�W7����j�*_Tm�岼֦4����eA��Zj���G��HA�� 

0
Matt
Top achievements
Rank 1
answered on 04 Jun 2010, 03:38 PM
Any help on this?
0
Accepted
Genady Sergeev
Telerik team
answered on 08 Jun 2010, 07:52 AM
Hello Matt,

You need to use the FileUploaded event in order to rename and save the uploaded file. Here is sample code that demonstrates the approach.

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" TargetFolder="Uploads">
    </telerik:RadAsyncUpload>

void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        string targetFolder = RadAsyncUpload1.TargetFolder;
        string newName= "newName";
        e.File.SaveAs(Path.Combine(Server.MapPath(targetFolder), newName + e.File.GetExtension()));
    }


Kind regards,
Genady Sergeev
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
Matt
Top achievements
Rank 1
answered on 17 Jun 2010, 02:21 PM
Thanks so much for that answer!  Worked like a charm.  Why isn't there a full demo of that in the demos section?  None of the demos show how to move files from the temp data folder.

Another question, how do I disable the Submit button while the image is uploading?  I know I've seen that demoed or discussed in a forum somewhere, but I can't find it and I guess I don't know how to search for it.  Can anyone help?

Thanks!


0
Accepted
Genady Sergeev
Telerik team
answered on 17 Jun 2010, 04:43 PM
Hello Matt,

Here is sample code that shows how to do it:

<asp:ScriptManager runat="server" ID="ScriptManager1">
</asp:ScriptManager>
 
<script type="text/javascript">
    function fileSelected(sender, args) {
        $get("Button1").disabled = "disabled";
    }
 
    function fileUploaded(sender, args) {
        $get("Button1").disabled = "";
    }
</script>
 
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" OnClientFileSelected="fileSelected" OnClientFileUploaded="fileUploaded">
</telerik:RadAsyncUpload>
 
<asp:Button runat="server" ID="Button1" Text="Postback" />


All the best,
Genady Sergeev
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
zozzancs
Top achievements
Rank 1
answered on 19 Jul 2010, 03:33 PM
Dear Genady,

Is there a way to find out the original name of the file?

I goal is to process the files like in this demo, but I want save the files as its' original names, not "newName..."
http://demos.telerik.com/aspnet-ajax/upload/examples/async/ajaxprocessing/defaultcs.aspx

Thank You!

Zoltan
0
zozzancs
Top achievements
Rank 1
answered on 19 Jul 2010, 04:07 PM
Nevermind, I figured it out.

protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{         
    string filename = e.UploadResult.FileName;
}
0
Umer Khalid Butt
Top achievements
Rank 1
answered on 15 Feb 2012, 07:28 AM
I am using the RadAsyncUpload control and its working fine. The only problem that I am facing is that how can I PrePopulate the selected files in the Upload control. Like if I have 2 files and I want them to be automatically selected on PageLoad event. How can I do that. Any help will be highly appreciated.

Thanks in advance
0
Bozhidar
Telerik team
answered on 15 Feb 2012, 09:56 AM
Hello Umer,

Please take a look at the following forum topic:
http://www.telerik.com/community/forums/aspnet-ajax/upload/upload-image-radupload-control-programatically.aspx 
 
All the best,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Wayne
Top achievements
Rank 1
answered on 16 Oct 2012, 09:23 AM
In reference to the sample code to disable a submit button whilst file being uploaded. Does this work? The fileuploaded does not fire if a user cancels a file upload? As far as I know there is no client side cancel event. I have found another post

http://www.telerik.com/community/forums/aspnet-ajax/async-upload/how-to-trap-when-user-clicks-on-cancel-button.aspx

that gave a work around to hook into a cancel click. I've been trying to prevent the user submitting a form containing radasyncupload control, it's configured to allow multiple file upload. I need to disable the submit or output an alert when clicked if there are files being uploaded. By wiring up filesselected and filesuploaded, through the work around for lack of cancel event and by keeping track of number of files selected and uploaded or cancelled I have a solution BUT this seems like hard work. Am I missing something obvious like a property IsBusy. Surely this is needed? Seems like a common scenario to want to know client side if the upload is still busy. I thought of using the progress event but again fail to see how that helps if a user cancels an upload.
0
Bozhidar
Telerik team
answered on 18 Oct 2012, 01:30 PM
Hello Wayne,

When a user cancels the upload, RadAsyncUpload fires the OnClientFileUploadFailed event, which you can use for your logic. There is one more scenario which you have to handle in order to cover all the cases - when the selected file doesn't pass the built-in validation ( controlled by the AllowedFileExtensions property ). In this case RadAsyncUpload fires the OnClientValidationFailed event.

In other words the final markup of the RadAsyncUpload should look like this:
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"
    OnClientFileSelected="disableButton"
    OnClientFileUploaded="enableButton"
    OnClientValidationFailed="enableButton"
    OnClientFileUploadFailed="enableButton">
</telerik:RadAsyncUpload>
 
Greetings,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Rob Gaudet
Top achievements
Rank 1
answered on 20 Jan 2013, 11:39 PM
I am using RadAsyncUpload. My users are only adding one file at a time.
It seems, as it stands now they have to click three times to upload a file.

How can I allow users to do it in three steps, one click.

1) press 'Upload File' which opens windows explorer.
2) select file from file system, press 'Open' in windows explorer.
3) file is automatically uploaded.

0
Rob Gaudet
Top achievements
Rank 1
answered on 21 Jan 2013, 04:46 PM
I agree with the first poster, btw. It's frustrating to not find really good simple examples to follow that could save huge amounts of time and effort learning to use these tools. Ugh.. I've been working on just uploading and renaming a single file for several hours now... lots of trying things and dead ends. It's coding, I'm used to it, just not on something that should be SO simple and I could easily accomplish just using straight .Net.

Please create better examples, it would dramatically improve your customers satisfaction rates.
0
Erin Manuel
Top achievements
Rank 1
answered on 23 Jan 2013, 05:32 PM
I would like to add my frustration to the lack of examples on actual manipulation of files. 
0
Plamen
Telerik team
answered on 24 Jan 2013, 06:33 AM
Hello,

 
Thank you for your feed back - we will definitely make our best to improve our documentation about these features.

@Rob One way to upload files before without having to click an upload button manually is by using the OnClientFilesUploaded event and trigger the post back with jQuery or by using ajax request as shown in the attached project.

@Erin: An easy way to get the file name(or other properties) of an uploaded file is by using fileUploaded server event as shows below:
 

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"
            TargetFolder="../../Uploads" OnFileUploaded="RadAsyncUpload1_FileUploaded"    >
    </telerik:RadAsyncUpload>
        <asp:Button Text="text" runat="server" />
protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{
    string targetFolder = RadAsyncUpload1.TargetFolder;
    Response.Write(Server.MapPath(targetFolder + "/" + e.File.FileName));
    
}

Hope this will be helpful. 


Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
MTC
Top achievements
Rank 1
answered on 25 Mar 2013, 10:16 AM
Hi,

I am using tekerik RadAsyncUploade Control . It works fine in my Local server(LAN)  but in Production(WAN).
In WAN it always goes to OnClientFileUploadFailed event and shows "Http Error Code is :500" as error message..
Please help me on this..
0
Plamen
Telerik team
answered on 28 Mar 2013, 10:31 AM
Hi MTC,

 
Such error is most often observed when some settings in the web config are not set properly. You can refer to this help topic where similar issue have been explained or compare your web config with the one in the AjaxProcessing.zip project that is attached in this thread.

Hope this will be helpful.

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
MTC
Top achievements
Rank 1
answered on 28 Mar 2013, 11:52 AM
ok..Thank you
0
Mark
Top achievements
Rank 1
answered on 25 May 2013, 05:47 PM
I agree. 

I find the examples for all the ASP.NET controls very difficult to follow. There is way too much emphasis on how to make it "pretty" and not enough on useful examples. 

The documentation for this control is a very good example. You have to search (I use Google) to get the documentation on to actually implement the control for anything useful. Why bother with the control if you're just saving the file to a temp folder?

I believe that since many of the controls are extensions of ASP controls Telerik believes we have the experience needed to work with their controls. This is not necessarily the case.

I find the controls very useful, but implementing them is way too frustrating.


0
Plamen
Telerik team
answered on 28 May 2013, 12:56 PM
Hi Mark,

 
Thank you for your concern with RadControls and for sharing your opinion about our documentation.

 I would like to clarify that we are constantly trying to improve it and provide more and more helpful articles and explanations how to use RadControls. If you have any concrete suggestions or recommendations about some article please share it with us so we could consider their improvement.

 As for RadAsyncUpload I am attaching a sample web page where I have implemented a RadAsyncUpload as in this help topic. Please have in mind that the file is uploaded to the target folder after PostBack (as explained in the overview topic)

Hope this will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Genady Sergeev
Telerik team
zozzancs
Top achievements
Rank 1
Umer Khalid Butt
Top achievements
Rank 1
Bozhidar
Telerik team
Wayne
Top achievements
Rank 1
Rob Gaudet
Top achievements
Rank 1
Erin Manuel
Top achievements
Rank 1
Plamen
Telerik team
MTC
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or