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

how to delete files

5 Answers 109 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 04 Aug 2011, 05:40 PM

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.

5 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 09 Aug 2011, 12:05 PM
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 >>

0
Sven
Top achievements
Rank 1
answered on 30 Aug 2011, 08:08 PM
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
0
Alex Fidanov
Telerik team
answered on 02 Sep 2011, 05:16 PM
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 >>

0
Sven
Top achievements
Rank 1
answered on 02 Sep 2011, 05:41 PM
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
0
Tina Stancheva
Telerik team
answered on 07 Sep 2011, 02:49 PM
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 >>

Tags
Upload
Asked by
Michael
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Sven
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or