Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: AjaxFileUpload faild on Azure [27302]

$
0
0
Hi,

I use the AjaxFileUpload to upload images to Blob Storage.

When I run the code on my computer, all is working but I can upload file in production environnement ?

I think the upload faild because IIS can't writte the file on the system.

I suppose that we should use the local storage as a temp folder. But how configure it ?

Regards,

Comments: My apologies.... the exception was raise in the function that upload the blob. However, you could improve the OnPreRender function by suppress the memory stream et by add the exceptioin message in the status. : protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (this.Page.Request.QueryString["contextkey"] == ContextKey && this.Page.Request.Files.Count > 0) { var serializer = new JavaScriptSerializer(); var jsonResult = ""; var guid = this.Page.Request.QueryString["guid"]; var uploadedFile = this.Page.Request.Files[0]; postedFile = uploadedFile; try { var bufferSize = uploadedFile.ContentLength; var buffer = new byte[bufferSize]; uploadedFile.InputStream.Read(buffer, 0, bufferSize); var eventArgs = new AjaxFileUploadEventArgs(guid, AjaxFileUploadState.Success, "Success", uploadedFile.FileName, uploadedFile.ContentLength, uploadedFile.ContentType, buffer); if (UploadComplete != null) UploadComplete(this, eventArgs); jsonResult = serializer.Serialize(eventArgs); } catch (Exception ex) { var eventArgs = new AjaxFileUploadEventArgs(guid, AjaxFileUploadState.Failed, String.Format("Failed : {0}", ex.Message), uploadedFile.FileName, uploadedFile.ContentLength, uploadedFile.ContentType,(byte[])null); jsonResult = serializer.Serialize(eventArgs); } Page.Response.ClearContent(); Page.Response.Write("<html><body>" + jsonResult + "</body></html>"); Page.Response.End(); } }

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>