How to change the Unzip directory from Appdomain BaseDirectory


I have an action where I am putting zip files and those zipped files are unzipped. Now, the problem is, when I am unzipping those files....those files are saved into the App_Data folder in a weird format. Note that, I am saving the directory path as the string in my database table(img1).

img1

What I want is, I want to save the path in normal string format like this,

img2

Because when I am trying to show those files like <a href="@Url.Content(Model.filepath)">Download</a>, I am not getting any file because of that weird format.

here is my controller(img13, img14, img15)

img3

img4

img5


Asked by:- SalmanZahir
0
: 2252 At:- 11/16/2017 11:13:49 AM
asp.net asp.net mvc







1 Answers
profileImage Answered by:- Sam

May be your issue is in path it must be

 string path = AppDomain.CurrentDomain.BaseDirectory + "/App_Data/uploads/"; 

Try saving above path using forward slash, take a reference from ZipFile.ExtractToDirectory(zipPath, extractPath);

You can also take a look on complete article on this

https://gallery.technet.microsoft.com/Programmatically-Extract-0544debd

https://www.codeguru.com/csharp/.net/zip-and-unzip-files-programmatically-in-c.htm

https://www.mikesdotnetting.com/article/306/working-with-zip-files-in-asp-net-mvc

Let me know if it doesn't help, i will test your code locally

0
At:- 11/16/2017 12:44:53 PM Updated at:- 11/16/2017 2:18:32 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use