I have run into a problem. I have a file upload that accepts a zip file and automatically unzips it through the DNN facilities (FileSystemUtils.UploadFile). The purpose is to allow uploading a zip file of images. I then loop over every image in the destination folder and generate a thumbnail (no problem there) and then try to resize the original by making a new bitmap and saving it as the original filename.jpg, and deleting the original. This poses some filelocking issues though apparently.
When the original filename IS 'filename.jpg', it fails to access the file to write it because it says the file is locked. Before I go further, yes, I am propperly disposing of the filehandle that had opened the file. And I know it works because if I upload a single file, everything works right, this only happens with a zip file. Also, when I call FileSystemUtils.DeleteFile, I get no error back (I think, I haven't checked the return string.. probably says it had an issue with file locking), but I assume it isn't deleting because of the same file locking issue.
So, who can tell me how to get around this? I tried simply uploading and then manually unzipping the file, but I get the same problem. So I'm wondering where this file locking is coming from. It doesn't seem to be DNN, as the single file upload doesn't lock the file, only uploading ZIP files, so I'm wondering if its some sort of Windows thing that is locking the files for longer than it should.
Ideas?