用于上载pdf文件的服务器路径。 [英] server path to upload the pdf file.

查看:196
本文介绍了用于上载pdf文件的服务器路径。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在服务器上传pdf文件时遇到问题。我使用以下代码在数据库上上传pdf文件,在本地服务器它工作正常。但是当我在服务器上使用此代码时,它无法正常工作。



代码如下:



hello everyone,

i am having problem while uploading the pdf file on server. i am using the following code for uploading the pdf file on database, in local server it''s working fine. but when i use this code on server it''s not working .

following code :

protected void btnsave_Click(object sender, EventArgs e)
    {
        if (flUpld.HasFile == false)
        {
            lblerror.Text = "select a file to upload";
        }
        else
        {
            try
            {
                string filename = flUpld.FileName;
                find =Request.ApplicationPath;
                flUpld.PostedFile.SaveAs(Server.MapPath(find+"\\results\\" + filename.Trim()));
                string path = find+"\\results\\" + filename.Trim();

                if (ChangeData.InsertResult(ddlcategory.SelectedValue.ToString(), ddlsubcategory.SelectedValue.ToString(),
                txttitle.Text, path))
                {
                    txttitle.Text = "";
                    lblerror.Text = "sucessfully submitted";
                }
                else
                {
                    lblerror.Text = "try again later ";
                }
            }
            catch (Exception ex)
            {
               // Response.Write(ex.ToString());
            }
        }
    }







任何人都可以自定义服务器代码..

提前感谢。




can anyone customize the code for server..
thanks in advance .

推荐答案

因为您的代码在本地计算机上工作正常,这意味着它没有错误。请检查您在服务器中上传pdf的文件夹是否启用了写入权限。如果没有,则启用该特定文件夹的写入权限。一切都会正常。
as your code is working fine in local machine that means that it is error free. Please do check that the folder in which you are uploading the pdf in the server has write permission enabled or not. If not then enable the write permission for that particular folder. and everything will work fine.


这篇关于用于上载pdf文件的服务器路径。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆