merhabalar..
localhost ta dosya ekleyebiliyorum ve daha sonra onu folder da gösterebiliyorum. Ama sunucu bilgisayarına programımı attığım zaman ekleyeceğim dosyayı sisteme ekleyebiliyorum fakat folder ı görüntüleyemiyorum.
Dosya Ekleme Kodu
protected void btnDosyaYukle_Click(object sender, EventArgs e)
{
{
string directorypath = Server.MapPath("~/Proje Döküman/");//yazılmasını istedigin path
string directorypath1 = Server.MapPath("~/Proje Döküman/" + txt_müsteriIsmi.Text + "/");
DirectoryInfo diNewDirectory = new DirectoryInfo(directorypath + txt_müsteriIsmi.Text);
DirectoryInfo diiNewDirectory = new DirectoryInfo(directorypath1 + txt_ProjeIsmi.Text);
if (!diNewDirectory.Exists)
{
diNewDirectory.Create();
}
else if (!diiNewDirectory.Exists)
{
diiNewDirectory.Create();
}
if (FileUpload2.HasFile)
try
{
FileUpload2.SaveAs(Server.MapPath("~/Proje Döküman/" + txt_müsteriIsmi.Text + "/" + txt_ProjeIsmi.Text + "/") + FileUpload2.FileName);
lblDosyaGoster.Text = FileUpload2.PostedFile.FileName + " Dosyası Yüklendi..";
}
catch (Exception ex)
{
lblDosyaGoster.Text = "Hata Oluştu: " + ex.Message.ToString();
}
else
{
lblDosyaGoster.Text = "Dosya Seçin ve Yükleyin";
}
}
}
Eklenen dosyaları göstermek için
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) //EKLERİ GÖSTER
{
string myPath = Server.MapPath("~/Proje Döküman/" + txt_müsteriIsmi.Text + "/" + txt_ProjeIsmi.Text + "/");
Process prc = new Process();
try
{
prc.StartInfo.FileName =myPath;
prc.Start();
}
catch (Exception)
{
LabelMessage.Text = "dosya bulunamadı";
//MessageBox.Show("Ek Bulunamadı..");
}
}
yani sonuc olarak localhostta iken eklediğim dosyayı görebiliyorum fakat program sunucudayken dosya bulunamadı hatası alıyorum yani path i görmüyor..