The error above means that either FileUp's cache directory and/or destination directory does not have the necessary permissions for FileUp to save the files that have been uploaded. The user account that FileUp is running as needs to have Read, Write, and Modify permissions to both the cache and destination directories.
First, check that your file paths are all spelled correctly in your code. Then, follow the instructions that follow to determine which account needs permission and which directories it is trying to access.
Determining the correct account
The default accounts that FileUp runs as are discussed below. The error message itself is a little misleading because FileUp does not always run as the IUSR_computername account. The following chart shows the default accounts that FileUp runs as for different versions of IIS and different web technologies:
||IIS5 (Windows 98, 2000, XP)
||IIS6 (Windows Server 2003)
There are a variety of other options that are possible, depending on your system and application configuration, including the following:
- In ASP: If your application is set in IIS to use Basic, Digest or Integrated Windows authentication, FileUp will run as the authenticated user.
- In ASP.NET: If impersonation is turned on in the machine.config or web.config file, FileUp will run as the user specified in the .config file. If impersonation is set to true but a user is not specified in the .config file, FileUp will use IIS's settings (Anonymous, Basic, Digest, or Integrated, as configured).
For more information see this MSDN article about impersonation in ASP.NET.
Determining the cache directory
The cache directory is typically set using FileUp's Path property, unless the HTTPModule or ISAPI filter is being used. If the Path property is not set it will default to the system temp directory. (This directory is determined by the TEMP environment variable, which is set in Control Panel, System, Advanced, Environment Variables.)
If you are using the HTTPModule or ISAPI filter, FileUp will choose a cache location based on a registry entry. This entry is initially set to the same path as the system's PATH environment variable. To find this registry setting, do the following:
- Open the Start menu and select Run.
- Enter regedit and click OK.
- Expand HKEY_LOCAL_MACHINE\SOFTWARE\Software Artisans\SA-FileUp\Parameters.
- The cache directory is set by the FileUpTempDir key (ISAPITempDir in FileUp v4). You can change this value if desired.
Determining the destination directory
The destination directory is set in one of two ways with FileUp:
- When calling Save(), the cache directory is used.
- When calling SaveAs(), the directory passed to SaveAs() is used.
Setting the permissions
As mentioned previously, the necessary account must have Read, Write, and Modify priveleges to the cache and destination directories. To set the necessary permissions for FileUp on a directory in Windows 2000, XP, or 2003 Server, do the following:
- In Windows Explorer, right click the directory you wish to set permissions on, and choose Properties.
- Click on the Security tab.
- In the Name panel, select the desired user from the list, or use the "Add..." button to add that user if it is not listed.
- In the Permissions panel, select the Modify checkbox under the Allow column. This will set all the necessary permissions for that user and FileUp.
- Click OK.
Special consideration for Windows 2003
In Windows 2003, if your cache or destination directory is within C:\inetpub\wwwroot\ or any of its subfolders you will need to perform one additional step. By default, there are deny priveleges for deletion that you must remove:
- On the Security tab of the folder properties, click the Advanced button.
- You should see an entry in the list that says "Deny Internet Guest Account Special...". Choose this entry and click the Edit button.
- Scroll down and uncheck the "Deny" column for "Delete Subfolders and Files".
- Click OK.