NeatUpload.DefaultTempDirectory has no effect

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

NeatUpload.DefaultTempDirectory has no effect

Hello, I have a 'resumes' dir that I would like all files to go to.  I set the following in the web.config:

<add key="NeatUpload.DefaultTempDirectory" value="./resumes/" />
I also tried :
"./resumes", "c:\...path to actual...\resumes", and "c:\...path to actual...\resumes\". 
However, after I run the app, nothing appears in the folder, and I don't see the file in the system temp folder either.

I got around this by using the moveto command as shown in the doc file.  strFolder is the Server.MapPath of my relative directory which is held in a different config key.

                inputFileId.TmpFile.MoveTo(Path.Combine(strFolder, Path.GetFileName(inputFileId.FileName)));

I realize the above line shouldn't work if I don't see it after running the app as I mention above. Am I looking in the wrong dir? 
Path.GetTempPath(); returns - "C:\Documents and Settings\<pcname>\ASPNET\Local Settings\Temp"
Reply | Threaded
Open this post in threaded view

Re: NeatUpload.DefaultTempDirectory has no effect

Dean Brettle
The file is only in the temp dir while the request is actually being processed.  When the request is over, the file is automatically deleted from the temp dir so that an attacker can't fill up all your disk space with bogus uploads.  An upload of a resume might only take a fraction of a second, so that is all the time that file would actually appear in the temp dir.  If you want to keep the file, you need to move/copy it to a new name/location like you have done.  Make sense?

To see the file in the temp dir, check the temp dir while uploading the file.  Note: It will have a temporary name, not the name on the client system. 

If you don't see the file in the temp dir during a large upload, the webserver might not have the requisite permissions or you might have specified the path incorrectly.  On a windows system, you could use either "resumes", ".\resumes", or "c:\..path to actual..\resumes".  For the first 2 paths, the directory would need to be a subdirectory of your app root.