开发者

How to set file upload storage path in .Net/IIS 7

开发者 https://www.devze.com 2023-04-01 15:16 出处:网络
I\'m developing a project, in which users upload rather large PDF files (up to 500Mb), and we\'re displaying a progress-bar for uploads.

I'm developing a project, in which users upload rather large PDF files (up to 500Mb), and we're displaying a progress-bar for uploads.

Recently I've had my Win-7 reinstalled, and after that our uploads are no more trackable. At previous installations of WinXP and Win-7 temporary upload files (*.post) were stored always at this location: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" With the current installation I've searched for *.post files during big upload, and found one at this location: "C:\Documents and Settings\my.username\AppData开发者_C百科\Local\Temp\Temporary ASP.NET Files\root\e81af262\ee4e4b74\uploads" There're multiple directories with such random names, so it's required to search for the most recent file in all such nested directories, to find the upload which was just started.

I don't like this idea too much, so the question is - is there any way to tell .Net where to put the uploaded temporary files.


You can specify the temporary directory using the compilation element in web.config. See: http://msdn.microsoft.com/en-us/library/s10awwz0(v=vs.71).aspx

Basically you can set it to the following.

<compilation debug="false" tempDirectory="X:\TempFiles"/>

Make sure the worker process and IUSR have write access to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消