Last post Mar 12, 2014 03:15 AM by Fuxiang Zhang - MSFT
Mar 10, 2014 12:44 PM|mrwww76|LINK
Currently, I have a project that is using the HTML 4 upload control within an IFRAME (to get some sort of async processing when uploading a file to a database – before the advent of the AJAX upload control).
A strange thing occurs when the user’s browser is set to Standards Mode for IE10-11. When the SRC tag of the IFRAME is programmatically changed on page load or post back any CSS (external CSS files) in the parent page containing “background-color” get removed
from the page once the IFRAME loading is complete . As it only occurs with IE in standards mode (IE7,Chrome, Firefox no issues), I’ve chalked it up to browser bug that will like never get addressed.
Anyway, I was trying to work with the AjaxUpload control (framework 3.5) so I could do away with the IFRAME. Is there any way to change the temp directory the control uses to process the file? By default it wants to use what Windows environment says (System.IO.Path.GetTempPath()).
This will not work when an application uses forms authentication when the web.config has
I do not see any control properties that allow me to set the path to be relative to the application. Ideally this should all be done in memory without the need for a temp file location, but that doesn’t appear to be the way the Ajax control is designed
for this framework.
Your input would be much appreciated. If anyway knows how to address the CSS breaking issue, I’m willing to work that route too.
Mar 12, 2014 03:15 AM|Fuxiang Zhang - MSFT|LINK
I do not see any control properties that allow me to set the path to be relative to the application. Ideally this should all be done in memory without the need for a temp file location, but that doesn’t appear to be the way the Ajax control is designed for
Thanks for your post.
The AjaxFileUpload control buffers the file being uploaded onto your web server's hard drive. This temporary folder is located at Path.GetTempPath().
When you call the SaveAs() method to save the uploaded file to a new location, the AjaxFileUpload control deletes the temporary file automatically.
In the server side we use a httphandler "AjaxFileUploadHandler.axd" to receive the file upload request, then copy file to project folder.
That can complete the asynchronous feature. So we should not di it in server memory.
For chaning the AjaxFileUpload temporary folder directory, you can try below static method of AjaxFileUpload.
AjaxControlToolkit.AjaxFileUpload.BuildTempFolder(), for more information you can refer to below thread.
Hope that helps, thanks.