الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

فتح ملف

مغلق
بدأه musaireae في 3 يونيو 2006 · 1 رد · 406 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمه الله وبركاته

لدي مشكله و اريد حلها و التي هي انني اريد افتح ملف موجود لدي في مسار معين عند الضغط على زر معين و ان يكون هناك خيار عند الفتح للملف ام بالحفظ على الجهاز او فتحه فقط.

فما العمل ....

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

#2

ابشركم وجدت الحل و لانني اردت ان يستفيد الجميع منه فقد وضعتة

string fileName = "TextFile1.txt";

// C:\Inetpub\wwwroot\Test\TextFile1.txt
fileName = this.Server.MapPath("~/" + fileName);

System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName);

this.Response.Clear();
this.Response.AddHeader("Content-Length", fileInfo.Length.ToString());
this.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
this.Response.ContentType = "application/octet-stream";
this.Response.WriteFile(fileInfo.FullName);
this.Response.Flush();
this.Response.End();

If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.

هذا الموضوع مغلق.

مواضيع مشابهة