Save website uploads in a subdomain

╄→尐↘猪︶ㄣ 提交于 2019-12-12 18:14:45

问题


Currently whenever a user uploads a file through our website, it gets put in a folder such as:

www.domain.com/Uploads/Docs/filename.doc

However, I'd like to move this to a subdomain such as:

uploads.domain.com/Docs/filename.doc

This is mainly because I'd like to keep the files uploaded by the user, totally seperate from the web app.

However, currently I use an ASP.NET FileUpload control to upload the files, by doing something like:

myFileUpload.SaveAs(Server.MapPath("/Uploads/Docs/filename.doc"))

How would I change this line of code to be able to upload to the subdomain easily?

Cheers.


回答1:


If both domains are on the same server, simply point the site for the subdomain to the /Uploads/Docs directory as the base directory.

You can then restrict this directory from your www domain.

Different sites can share the filesystem and this may be a good solution for your problem, without changing any code.



来源:https://stackoverflow.com/questions/4104671/save-website-uploads-in-a-subdomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!