I would like to use the RadAsyncUpload control without using a temporary file. I just need the stream to pass to another function(e.File.InputStream). How can I accomplish this?
It works for me when I run it in Visual Studio, but fails when I deploy it to the server. I am setting my Temporary Folder to a folder in the HttpContext.Current.Server.MapPath. The user machine will not have that path.
My ascx file:
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUploadLetterFile" AllowedFileExtensions="rtf,rtfb" Width="225px"
OnFileUploaded="RadAsyncUploadLetterFile_FileUploaded" MaxFileInputsCount="1" DisablePlugins="True"
PostbackTriggers="btnUpload" OnClientFileUploadFailed="onClientFileUploadFailed"
EnablePermissionsCheck="False" DisableChunkUpload="True" UseApplicationPoolImpersonation="True"
Skin="Web20" MultipleFileSelection="Disabled" >
</telerik:RadAsyncUpload>
ascx.cs:
public void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadAsyncUploadLetterFile.TemporaryFolder = HttpContext.Current.Server.MapPath(@"..\..\Reports");
}
}
It works for me when I run it in Visual Studio, but fails when I deploy it to the server. I am setting my Temporary Folder to a folder in the HttpContext.Current.Server.MapPath. The user machine will not have that path.
My ascx file:
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUploadLetterFile" AllowedFileExtensions="rtf,rtfb" Width="225px"
OnFileUploaded="RadAsyncUploadLetterFile_FileUploaded" MaxFileInputsCount="1" DisablePlugins="True"
PostbackTriggers="btnUpload" OnClientFileUploadFailed="onClientFileUploadFailed"
EnablePermissionsCheck="False" DisableChunkUpload="True" UseApplicationPoolImpersonation="True"
Skin="Web20" MultipleFileSelection="Disabled" >
</telerik:RadAsyncUpload>
ascx.cs:
public void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadAsyncUploadLetterFile.TemporaryFolder = HttpContext.Current.Server.MapPath(@"..\..\Reports");
}
}
8 Answers, 1 is accepted
0

Christine
Top achievements
Rank 1
answered on 17 Jul 2013, 06:51 PM
A little more info: On the server, it fails on the selection of the file. It never gets to OnFileUploaded="RadAsyncUploadLetterFile_FileUploaded".
0
Hi,
If you don't want to use temporary files, do not set TemporaryFolder property. The other thing you did correctly is to set DisableChunkUpload to true. Then save uploaded file directly into the Target folder. I'm attaching small sample showing how to do that by using Custom Http Handler.
Regarding your other issue: When project is deployed on IIS it requires to have write permissions to both Temp and Target folders. Verify that your application has the correct permissions.
Regards,
Hristo Valyavicharski
Telerik
If you don't want to use temporary files, do not set TemporaryFolder property. The other thing you did correctly is to set DisableChunkUpload to true. Then save uploaded file directly into the Target folder. I'm attaching small sample showing how to do that by using Custom Http Handler.
protected
override
IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration,
string
tempFileName)
{
string
targetFolder = context.Server.MapPath(
"~/Reports"
);
string
fileName = file.GetName();
//Replace this with yours function(file.InputStream)
file.SaveAs(targetFolder +
"/"
+ fileName);
return
CreateDefaultUploadResult<UploadedFileInfo>(file);
}
}
Regarding your other issue: When project is deployed on IIS it requires to have write permissions to both Temp and Target folders. Verify that your application has the correct permissions.
Regards,
Hristo Valyavicharski
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 the blog feed now.
0

Syed
Top achievements
Rank 1
answered on 28 Jul 2013, 06:11 PM
Hello,
I need help on finding a solution on how to handle the exceptions found in the handler's Process method at the client side's OnClientFileUploadFailed event function. Assume we are doing multiple operation in the Process method like saving the file into file system and also into the database. whenever the file operation or the DB operation fails i need to send appropriate action to the client side so that i can display user friendly localized string.
I tried doing throw new Exception("") but it sends me whole html content along with the message i am trying to send. I want to send one unique number here which will be the ID of the resource string so that at the client side i can pick that localized string based on that resource string ID recieved from the handler in the OnClientFileUploadFailed event function.
Also is it possible to send the querystring like we send to the handler if we are not using the handler to take those querystring values in the onfileuploaded event?
Appreciate your help on this.
Thanks,
Saleem
I need help on finding a solution on how to handle the exceptions found in the handler's Process method at the client side's OnClientFileUploadFailed event function. Assume we are doing multiple operation in the Process method like saving the file into file system and also into the database. whenever the file operation or the DB operation fails i need to send appropriate action to the client side so that i can display user friendly localized string.
I tried doing throw new Exception("") but it sends me whole html content along with the message i am trying to send. I want to send one unique number here which will be the ID of the resource string so that at the client side i can pick that localized string based on that resource string ID recieved from the handler in the OnClientFileUploadFailed event function.
Also is it possible to send the querystring like we send to the handler if we are not using the handler to take those querystring values in the onfileuploaded event?
Appreciate your help on this.
Thanks,
Saleem
0
Hi Saleem,
Hristo Valyavicharski
Telerik
In handler create custom upload result by using CreateUploadResult<T> method. Then handle the exception and return the custom result. This will pass the values to the client where you will be able to process them. This on-line demo shows how to do that.
Regarding the seconds question: OnFileUploaded is a server event and there is no problem to read values from the query string.
Hristo Valyavicharski
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 the blog feed now.
0

Rodrigo
Top achievements
Rank 1
answered on 31 Jul 2014, 03:50 PM
Hi,
I'm trying to test the RadAsyncUpload without temporary folders and files. All works fine when using the FileAPI, but when I tested this with IE 9 it doesn't use Silverlight and I can only upload one file at a time.
I have disabled the chunkupload (set to true), and also removed the temporary folder location.
Thanks in advance
Rodrigo
I'm trying to test the RadAsyncUpload without temporary folders and files. All works fine when using the FileAPI, but when I tested this with IE 9 it doesn't use Silverlight and I can only upload one file at a time.
I have disabled the chunkupload (set to true), and also removed the temporary folder location.
Thanks in advance
Rodrigo
0
Hi Rodrigo,
If FileAPI, Flash and Silverlight are not available, the AsyncUpload will use IFrame module. It does not support multi-file selection. http://www.telerik.com/help/aspnet-ajax/asyncupload-multiple-file-upload.html
Regards,
Hristo Valyavicharski
Telerik
If FileAPI, Flash and Silverlight are not available, the AsyncUpload will use IFrame module. It does not support multi-file selection. http://www.telerik.com/help/aspnet-ajax/asyncupload-multiple-file-upload.html
Regards,
Hristo Valyavicharski
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.
0

Rodrigo
Top achievements
Rank 1
answered on 05 Aug 2014, 02:57 PM
Hi Hristo,
Thanks for you answer. In my scenario Silverlight is available. The only problem is that if a disable the temporary folder and chunck upload the control is using IFrame instead of Silverlight . Is there a way I can disable the temporary folder feature and still use the Silverlight module?
Regards,
Rodrigo
Thanks for you answer. In my scenario Silverlight is available. The only problem is that if a disable the temporary folder and chunck upload the control is using IFrame instead of Silverlight . Is there a way I can disable the temporary folder feature and still use the Silverlight module?
Regards,
Rodrigo
0
Hello Rodrigo,
Unfortunatelly this is not posslbe. You can see that mentioned here:
http://www.telerik.com/help/aspnet-ajax/asyncupload-disable-chunk-upload.html
Disabling Chunk Uploading will automatically disable Flash and Silverlight plugins.
Regards,
Hristo Valyavicharski
Telerik
Unfortunatelly this is not posslbe. You can see that mentioned here:
http://www.telerik.com/help/aspnet-ajax/asyncupload-disable-chunk-upload.html
Disabling Chunk Uploading will automatically disable Flash and Silverlight plugins.
Regards,
Hristo Valyavicharski
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.