I am trying to add a photo upload to my site. I am going to upload to my site prior to storing it long term on Amazon s3.
This is the code I am using:
using (var fs = new FileStream(fullpath, FileMode.Create)) { while (startlength < totalContentLength) { int bytes = FileUpload1.PostedFile.InputStream.Read(buffer, 0, bufferSize); startlength += bytes; fs.Write(buffer, 0, bytes); _percent = Convert.ToInt32(startlength * 100 / totalContentLength / 2); Cache[_processkey] = _percent; } fs.Seek(0, SeekOrigin.Begin); var thumbnailbytes = new byte[fs.Length]; fs.Read(thumbnailbytes, 0, Convert.ToInt32(fs.Length)); thumbnailbytes = GlobalUtilities.ResizeImage(thumbnailbytes, GlobalSettings.CustomerImages.MaxThumbnailImageWidth, GlobalSettings.CustomerImages.MaxThumbnailImageHeight); File.WriteAllBytes(fullpath, thumbnailbytes); } I have given access to both Everyone and IIS_USRS to the fullpath directory and I am running Visual Studio 2013 as an administrator. However, when it gets to this line in the code:
using (var fs = new FileStream(fullpath, FileMode.Create)) I get an error that
Access to the path 'C:\Users\ME\Documents\Business\Folder\repos\vb\Z\Replicated\Replicated\test\before_b3874a79-1e75-44df-bc47-6940ad4f496e.jpg' is denied.
What am I missing or doing wrong?
I am running VS2013 and debuggin via IIS.