how to delete files

6 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Mar 2011

    Posted 04 Aug 2011 Link to this post

    I’m using Telerik Silverlight Upload control to upload images/documents and then the file names are saved with records in the database.

    When the record in the database is deleted I want to remove the associated images and documents.

    When the user clicks the Delete button in the Silverlight UI a webservice is called to delete the database record  and I am trying to also trying to call the ashx handler directly (not through the Silverlight upload control) to remove the record.

     

    Is there an example showing how to call the  ashx handler passing the file name  to remove a file.

    Thank you,
    Michael.

  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 09 Aug 2011 Link to this post

    Hello Michael,

    You do not really need the RadUploadHandler to delete the file. Assuming that you have access to the File system, you can use the System.IO.File class to delete the local file and all you need to do this is the file's name.

    Greetings,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Sven
    Sven avatar
    19 posts
    Member since:
    Feb 2011

    Posted 30 Aug 2011 Link to this post

    Hi guys,

    I used the RadUpload to upload files to a virtual directory on the server and am storing the path and file name in a DB. For example the document_link filed will have /Virtual_Directory/Sub_Directory/filename.ext. When i try to delete the file using System.IO.File.Delete(document_link), I get an access denied error. I tried allowing everyone with Full Access just to see if that would help but to no avail.

    I know this is not really an issue with the Telerik product but I would really appreciate your expertise.

    Thanks
    SD
  5. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 02 Sep 2011 Link to this post

    Hello Sven,

    What is the server environment that you are using (OS - Windows Server, etc)? Have you deployed your application with IIS? I believe all these settings could be related to the restricted permissions over the file.

    Regards,
    Alex Fidanov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Sven
    Sven avatar
    19 posts
    Member since:
    Feb 2011

    Posted 02 Sep 2011 Link to this post

    Hi Alex,

    Thank you for taking the time to help me with this. I have IIS7 on Windows 2008 R2 server - 64bit. 

    Let me know your thoughts.

    regards
    SD
  7. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 07 Sep 2011 Link to this post

    Hello Sven,

    Thank you for getting back to us. It seems that as Alex suggested the issue lies somewhere in the IIS server configuration. You need to check that all authorization rights are properly set. You can find this article helpful.

    Also, you can try adding a sample file in the virtual directory and accessing it thought a browser. If there is an 'access denied' exception, in the browser you should be able to get more details of the error thus pointing you to the cause of the issue.

    Unfortunately since we cannot reproduce the same exception in our environment, we cannot be sure what is the cause and this is why any details that you have about the exception might help us narrow down the cause and advice you what to look for.

    Best wishes,
    Tina Stancheva
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top
DevCraft banner