Hi there,
I have a form with several fields and I need to allow our users to upload some files.
Those files need to be stored under current entity id, i.e., I need them to be uploaded with the form itself, not before, just like old upload control did, so I could do something like this:
How can I achieve that?
Thank you,
I have a form with several fields and I need to allow our users to upload some files.
Those files need to be stored under current entity id, i.e., I need them to be uploaded with the form itself, not before, just like old upload control did, so I could do something like this:
var data =
new
MyEntity();
// it can be a new object, so I do not have an ID until I save it
data.Title = txtTitle.Text;
// and so on...
data.Save();
foreach
(var file
in
asyncUpload.UploadedFiles)
{
data.Attachments.Add(file);
}
How can I achieve that?
Thank you,
6 Answers, 1 is accepted
0
Rubens
Top achievements
Rank 1
answered on 27 Jan 2014, 09:54 PM
Reading other questions, I should add :
- I can't use a temporary storage folder
- I can't use FileUploaded event handler, as I need them on save button click event
- I'm using SharePoint 2010 (but this doesn't seems an issue right now)
Thanks!
0
Rubens
Top achievements
Rank 1
answered on 28 Jan 2014, 12:08 AM
Seems I was missing some modules and handlers information on web.config; for all entries I had to inform my current Telerik version (2013.3.1114.35)
0
Andrew
Top achievements
Rank 1
answered on 28 Jan 2014, 12:37 AM
Hi Rubens, I'm trying to get similar functionality where the files are only uploaded on page submit, and the files aren't saved to the server filesystem. I'm basically streaming the uploaded filestream into an email attachment.
What additional config items did you have to add into the web.config? Did you need to set any specific attributes on the RadAsyncUpload control?
Thanks!
What additional config items did you have to add into the web.config? Did you need to set any specific attributes on the RadAsyncUpload control?
Thanks!
0
Rubens
Top achievements
Rank 1
answered on 28 Jan 2014, 01:05 AM
I had to add:
I have no additional attribute on RadAsyncUpload except for MultipleFileSelection="Automatic", as I currently need it.
Good luck!
<
modules
runAllManagedModulesForAllRequests
=
"true"
>
...
<
add
name
=
"RadUploadModule"
type
=
"Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"managedHandler"
/>
</
modules
>
<
handlers
>
... <
add
name
=
"ChartImage.axd_*"
path
=
"ChartImage.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"integratedMode"
/>
<
add
name
=
"Telerik.Web.UI.SpellCheckHandler.axd_*"
path
=
"Telerik.Web.UI.SpellCheckHandler.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"integratedMode"
/>
<
add
name
=
"Telerik.Web.UI.DialogHandler.aspx_*"
path
=
"Telerik.Web.UI.DialogHandler.aspx"
verb
=
"*"
type
=
"Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"integratedMode"
/>
<
add
name
=
"Telerik.RadUploadProgressHandler.ashx_*"
path
=
"Telerik.RadUploadProgressHandler.ashx"
verb
=
"*"
type
=
"Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"integratedMode"
/>
<
add
name
=
"Telerik.Web.UI.WebResource"
path
=
"Telerik.Web.UI.WebResource.axd"
verb
=
"*"
type
=
"Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
preCondition
=
"integratedMode"
/>
</
handlers
>
I have no additional attribute on RadAsyncUpload except for MultipleFileSelection="Automatic", as I currently need it.
Good luck!
0
Jennifer
Top achievements
Rank 1
answered on 18 Feb 2014, 11:46 PM
I need to do the same thing. I want to have the files uploaded when the user click the submit button on the form. I am a little confused by the answer in this thread though. Rubens, all you did was add this module and it no longer did the update when the user selected the file? Can you please exand on your solution?
Thanks.
Thanks.
0
Shinu
Top achievements
Rank 2
answered on 19 Feb 2014, 04:33 AM
Hi Jennifer,
I guess that you want to upload the files to TargetFolder when the user clicks the submit button. Please have a look into the sample code snippet which works fine at my end.
ASPX:
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
I guess that you want to upload the files to TargetFolder when the user clicks the submit button. Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
PostbackTriggers
=
"RadButton1"
MultipleFileSelection
=
"Automatic"
TargetFolder
=
"Uploads"
>
</
telerik:RadAsyncUpload
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Submit"
>
</
telerik:RadButton
>
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.