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

problem with upload

12 Answers 118 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Caro
Top achievements
Rank 1
Caro asked on 26 Apr 2012, 10:43 AM
hi,

I have a radUpload control named "radUp".

When I click on the submit button I call "uploadFile" :
"renameFile" is the new name written by the user on a textbox.
I want to save the file with this name, but I have 2 files on my Directory "Documents" after click: the renamed file and the other .... I want only the renamed file ... what's wrong?

protected void uploadFile()
        {
            if (radUp.UploadedFiles.Count > 0)
            {
                foreach (UploadedFile file in radUp.UploadedFiles)
                {
                    String targetFolder = Server.MapPath("~/Documents");
                    file.SaveAs(Path.Combine(targetFolder, renameFile.Text));
                }
            }
        }

Thanks

12 Answers, 1 is accepted

Sort by
0
Caro
Top achievements
Rank 1
answered on 26 Apr 2012, 11:44 AM
up
0
Caro
Top achievements
Rank 1
answered on 30 Apr 2012, 11:49 AM
Hi,

I have found the solution for my problem ... but I have an other problem ... :)

Exists doesn't works

 
foreach (UploadedFile file in up.UploadedFiles)
{
      if (System.IO.File.Exists(Path.Combine(targetFolder, doc.Text)))
       {
            label1.Visible = true;
       }
}

What's wrong please?

Thx

               
                      
0
Caro
Top achievements
Rank 1
answered on 30 Apr 2012, 12:34 PM
Ok, I've found my error, sorry
0
Med
Top achievements
Rank 1
answered on 04 May 2012, 10:57 AM
HI Caro,
I would like to upload a file and save it in a folder hier my poste :
http://www.telerik.com/community/forums/aspnet-ajax/upload/a-simple-upload-and-save-file-in-a-folder.aspx  
 but it doesn't work ! I dont know why ! can you help me please ?
Thankx 

  

0
Bozhidar
Telerik team
answered on 09 May 2012, 07:05 AM
Hello Med, 

Could you open a support ticket and attach a sample solution demonstrating the issue, so that we can determine where the problem is.

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
Waseem
Top achievements
Rank 1
answered on 20 Oct 2012, 12:06 AM
Hi I am trying to upload File by using RadUpload. Its work on local pc as well as on Server. But on our one client pc (Window 7). it cause error. I am 100 % sure about my code. Its working great. Is there any permission or what is this?

Could not find a part of the path 'D:\Testing\Test.pdf'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.

[DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +216
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +2481
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +229
0
Bozhidar
Telerik team
answered on 24 Oct 2012, 07:53 AM
Hi Waseem,

Could you send the markup of the RadUpload, as well as the code behind that takes care of the uploading.

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
Waseem
Top achievements
Rank 1
answered on 24 Oct 2012, 05:32 PM
I attached my code. Please check and let me know. There is another person who is also helping me in this. This is a url:
http://www.telerik.com/community/forums/aspnet-ajax/upload/radupload-and-radprogress-last-file-does-not-appear-to-finish.aspx

Thanks Bozhidar

0
Bozhidar
Telerik team
answered on 25 Oct 2012, 07:21 AM
Hello Waseem,

In order to prevent unwanted clutter, please continue the discussion in the other thread.
 
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
Waseem
Top achievements
Rank 1
answered on 14 Nov 2012, 04:54 PM
I am very worry about this issue?
Path is 100% correct and has full permission. Its work locally as well as on server. but one of our client get this error. i have no idea.
Can you help me in this? Please see latest images.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.

[DirectoryNotFoundException: Could not find a part of the path 'D:\Testing\Test.pdf'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +216
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +2481
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +229
0
Plamen
Telerik team
answered on 16 Nov 2012, 07:29 AM
Hello Waseem,

 
We are not aware of such error to be caused by the default behavior of RadUpload and we have not been reported as well -so it  should be some how caused by your additional custom code and functionality. I will recommend you to refer to this forum thread where general solutions for this issue have been provided.

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
Waseem
Top achievements
Rank 1
answered on 24 Nov 2012, 02:21 PM
Hello Plamen
I got the solution of this issue, its only arise in IE on few particular computer. After uploading it again and again and checking on client computer. i figure out this.

This problem is arise due to this: When we getting UploadedFile  name [  file.FileName.ToString() ]
So need to use this
file.GetNameWithoutExtension() + file.GetExtension();
instead of file.FileName.ToString();

string targetFolder = System.Web.HttpContext.Current.Server.MapPath(@"~/TestUpload");
string file1 = file.GetNameWithoutExtension() + file.GetExtension();
string targetFileName = System.IO.Path.Combine(targetFolder, file1);

Thanks,
Muhammad Waseem
Tags
Upload (Obsolete)
Asked by
Caro
Top achievements
Rank 1
Answers by
Caro
Top achievements
Rank 1
Med
Top achievements
Rank 1
Bozhidar
Telerik team
Waseem
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or