problem with upload

Thread is closed for posting
13 posts, 0 answers
  1. Caro
    Caro avatar
    34 posts
    Member since:
    Mar 2012

    Posted 26 Apr 2012 Link to this post

    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
  2. Caro
    Caro avatar
    34 posts
    Member since:
    Mar 2012

    Posted 26 Apr 2012 Link to this post

    up
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Caro
    Caro avatar
    34 posts
    Member since:
    Mar 2012

    Posted 30 Apr 2012 Link to this post

    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

                   
                          
  5. Caro
    Caro avatar
    34 posts
    Member since:
    Mar 2012

    Posted 30 Apr 2012 Link to this post

    Ok, I've found my error, sorry
  6. Med
    Med avatar
    11 posts
    Member since:
    Apr 2012

    Posted 04 May 2012 Link to this post

    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 

      

  7. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 09 May 2012 Link to this post

    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.
  8. <span>w</span>
    <span>w</span> avatar
    84 posts
    Member since:
    Jun 2012

    Posted 19 Oct 2012 Link to this post

    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
  9. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 24 Oct 2012 Link to this post

    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.
  10. <span>w</span>
    <span>w</span> avatar
    84 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2012 Link to this post

    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

  11. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 25 Oct 2012 Link to this post

    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.
  12. <span>w</span>
    <span>w</span> avatar
    84 posts
    Member since:
    Jun 2012

    Posted 14 Nov 2012 Link to this post

    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
  13. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 16 Nov 2012 Link to this post

    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.
  14. <span>w</span>
    <span>w</span> avatar
    84 posts
    Member since:
    Jun 2012

    Posted 24 Nov 2012 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017