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

File Upload control temporary file

5 Answers 272 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Mugdha Aditya
Top achievements
Rank 1
Mugdha Aditya asked on 29 Nov 2011, 02:48 PM
Hello ,

am using  RadAsyncUpload .
below is my code

 

//To validate upload control.
       function validationFailed(sender, eventArgs) {
           $telerik.$(".ErrorHolder").html("");
           $(".ErrorHolder").append("<p>Attachment exceeding the maximum total size for the file '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
       }
       //Remove Error Message.
       function RemoveErrorMessage(sender, eventArgs) {
           $(".ErrorHolder").fadeOut("slow");
       }

 


 

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload" MultipleFileSelection="Disabled" TemporaryFolder="attachments"
                            TargetFolder="attachments" MaxFileSize="524288" OnFileUploaded="RadAsyncUpload_FileUploaded"  
                            OnClientValidationFailed="validationFailed" MaxFileInputsCount="1" OnClientFileUploadRemoved="RemoveErrorMessage">
                        </telerik:RadAsyncUpload>


 

public void RadAsyncUpload_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            Label fileName = new Label();
            fileName.Text = e.File.FileName;
            string strFileName = string.Empty;
  
            if (itotalBytes < iMaxTotalBytes)
            {
                // Total bytes limit has not been reached, accept the file
                e.IsValid = true;
                itotalBytes += e.File.ContentLength;
            }
            else
            {
                // Limit reached, discard the file
                e.IsValid = false;
            }
  
            if (e.IsValid)
            {
                string targetFolder = RadAsyncUpload.TargetFolder;
                strFileName = e.File.FileName;
                //If same file uploaded again then it will overwrite.
                e.File.SaveAs(Path.Combine(Server.MapPath(targetFolder), strFileName));
            }
        }

It creates RadUploadTestFile file by default in attachment folder.
Why so?? Can we avoid that?

Plus it creates some wired ext file which i upload ... :(

5 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 29 Nov 2011, 06:08 PM
Hi Mugdha Aditya,

RadAsyncUpload uses this test file to check the write permittions on the selected folder. And unfortunatelly there isn't a way to remove it.

All the best,
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
Mugdha Aditya
Top achievements
Rank 1
answered on 29 Nov 2011, 06:19 PM
Thanx for your reply.

but what about other files which creates their. Whenever i upload any file , it creates file there with some weird extention.
how to avoid that, i want to save uplaoded file but used another way for that.
.SaveAs() and after i reomevd those file. but while uploading it creates another file with weird ext , which i dnt want
0
Bozhidar
Telerik team
answered on 01 Dec 2011, 09:51 AM
Hi Mugdha Aditya,

I wasn't able to reproduce your issue. Please run the attached working project and tell me if it still causes the problem. On my end, it only adds one test file to the temp folder, no matter how many times I upload files.

Kind regards,
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
Genady Sergeev
Telerik team
answered on 01 Dec 2011, 10:28 AM
Hello Mugdha Aditya,


Greetings,
Genady Sergeev
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
Mugdha Aditya
Top achievements
Rank 1
answered on 01 Dec 2011, 10:32 AM
Hey, thanx for the reply.

 i resolve my issue by using new dll . :)
Tags
Upload (Obsolete)
Asked by
Mugdha Aditya
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Mugdha Aditya
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or