Below is the code i'm using and I'm have a few questions regarding whats happening.
1) The file never actually saves, i click submit and it appears to work but the file never saves to my target directory. How do I resolve this.
2) When i try a second time to save a file i get directory access is denied, not sure what.
3) when I use a HTML5 browser and the drag and drop functionality is present, i'm able to save to a test directory C:\test with whatever file I choose, however, when I use RadUpload (non HTML5) i keep getting physical error paths messages. How do I resolve this? I need to be able to save to a specific folder.
.aspx.cs
1) The file never actually saves, i click submit and it appears to work but the file never saves to my target directory. How do I resolve this.
2) When i try a second time to save a file i get directory access is denied, not sure what.
3) when I use a HTML5 browser and the drag and drop functionality is present, i'm able to save to a test directory C:\test with whatever file I choose, however, when I use RadUpload (non HTML5) i keep getting physical error paths messages. How do I resolve this? I need to be able to save to a specific folder.
var $ = $telerik.$;
function pageLoad() {
if (!Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable()) {
$(".wrapper").replaceWith(
$(""));
}
}
function added(sender, args) {
if (Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable()) {
$(".ruDropZone").html("<
br
/><
div
align=\"center\"><
img
src=\"images/toolboxdragdrop.jpg\"></
div
>");
$(".nonHTML5").replaceWith(
$(""));
}
}
</
script
>
<
div
class
=
"wrapper"
>
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
OnClientAdded
=
"added"
OnFileUploaded
=
"RadAsyncUpload1_FileUploaded"
>
</
telerik:RadAsyncUpload
>
<
telerik:RadProgressManager
ID
=
"Radprogressmanager1"
runat
=
"server"
/>
</
div
>
<
div
class
=
"nonHTML5"
style
=
"position:relative;"
>
<
table
>
<
tr
>
<
td
id
=
"controlContainer"
>
<
telerik:RadUpload
ID
=
"RadUpload1"
runat
=
"server"
MaxFileInputsCount
=
"5"
OverwriteExistingFiles
=
"true"
OnFileUploaded
=
"RadAsyncUpload1_FileUploaded"
/>
<
telerik:RadProgressArea
ID
=
"progressArea1"
runat
=
"server"
/>
</
td
>
<
td
>
<
div
class
=
"smallModule"
>
<
div
class
=
"rc1"
>
<
div
class
=
"rc2"
>
<
div
class
=
"rc3"
style
=
"width:240px"
>
<
asp:Label
ID
=
"labelNoResults"
runat
=
"server"
Visible
=
"True"
>No uploaded files yet</
asp:Label
>
<
asp:Repeater
ID
=
"repeaterResults"
runat
=
"server"
Visible
=
"False"
>
<
HeaderTemplate
>
<
div
class
=
"title"
>
Uploaded files in the target folder:</
div
>
</
HeaderTemplate
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "FileName")%>
<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%>
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
</
div
>
</
div
>
</
div
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
div
>
<
asp:Button
ID
=
"buttonSubmit"
runat
=
"server"
CssClass
=
"RadUploadSubmit"
OnClick
=
"buttonSubmit_Click"
text
=
"Submit"
/>
</
td
>
.aspx.cs
public
void
RadAsyncUpload1_FileUploaded(
object
sender, FileUploadedEventArgs e)
{
RadAsyncUpload1.TargetFolder = MechanicToolboxClass.ToolBoxSaveToFolder();
}
protected
void
buttonSubmit_Click(
object
sender, System.EventArgs e)
{
if
(RadUpload1.UploadedFiles.Count > 0)
{
TargetFolderUpload = MechanicToolboxClass.ToolBoxSaveToFolder();
RadUpload1.TargetFolder = TargetFolderUpload;
repeaterResults.DataSource = RadUpload1.UploadedFiles;
repeaterResults.DataBind();
labelNoResults.Visible =
false
;
repeaterResults.Visible =
true
;
}
else
{
labelNoResults.Visible =
true
;
repeaterResults.Visible =
false
;
}
}