将文件上传到实际的服务器

将文件上传到实际的服务器

本文介绍了将文件上传到实际的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在将网站发布到服务器后上传文件,

上传在本地完美运行但在发布此代码后无法上传到服务器



Trying to upload a file after publishing the site to the server,
uploading works perfectly in local but am not able to upload to the server after publish this my code

var uploadedFile = new UploadedFile();

                 for (int i = 0; i < Request.Files.Count; i++)
                 {
                     HttpPostedFileBase file = Request.Files[i];
                     int fileSize = file.ContentLength;
                     string fileName = file.FileName;
                     fileName = Path.GetFileName(file.FileName);
                     string mimeType = file.ContentType;
                     System.IO.Stream fileContent = file.InputStream;

                     file.SaveAs(Server.MapPath("~/Images/") + fileName);
                     }







当我上传到服务器时,即我之后应该更改上述代码发布???




should i change the above code when i am uploading to server i.e. after publishing ???

推荐答案


这篇关于将文件上传到实际的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 13:19