So the problem is that you want to handle the upload image through Bitmap class and you get such exception error? If yes, then the issue for me is that you are not specifying the correct constructor param to Bitmap class here:
Bitmap originalBMP = new Bitmap(context.Response.OutputStream);
To get the content of the uploaded file you should replace that line by this one:
Bitmap originalBMP = new Bitmap(context.Request.Files[0].InputStream);
HTH
Barcode, Labeling, Printing & Imaging tools for ASP.NET Developers
So the problem is that you want to handle the upload image through Bitmap class and you get such exception error? If yes, then the issue for me is that you are not specifying the correct constructor param to Bitmap class here:
Bitmap originalBMP = new Bitmap(context.Response.OutputStream);
To get the content of the uploaded file you should replace that line by this one:
Bitmap originalBMP = new Bitmap(context.Request.Files[0].InputStream);
pasluc7469
0 Points
12 Posts
resize an Image sent by ajax
Nov 10, 2012 01:23 PM|LINK
hi experts, i have a problem with , hope someone can help me!!!
I have an aspx page with this code:
on the button click, i call this ajax function:
$.ajaxFileUpload ( { url: 'WebServices/ImageHandler.ashx', secureuri: false, fileElementId: 'fileToUpload', dataType: 'json', data: { name: 'logan', id: 'id', idArticle: idArticle }, success: function (data, status) { if (typeof (data.error) != 'undefined') { if (data.error != '') { alert(data.error); } else { alert(data.msg); } } }, error: function (data, status, e) { alert(e); } } )the issue is in the .ashx file, because i'm not be able to get a Bitmap object
public void ProcessRequest(HttpContext context) { if (context.Request.Files.Count > 0) { ........ Bitmap originalBMP = new Bitmap(context.Response.OutputStream); ....... }Exeption: NotSupportedException...
how can i fix this problem???
Thank you in advance.
Song-Tian - ...
All-Star
43699 Points
4304 Posts
Microsoft
Re: resize an Image sent by ajax
Nov 13, 2012 06:43 AM|LINK
Hi,
For Bitmap, please refer to: http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx.
Feedback to us
Develop and promote your apps in Windows Store
Neodynamic
Participant
988 Points
283 Posts
Re: resize an Image sent by ajax
Nov 13, 2012 09:30 AM|LINK
So the problem is that you want to handle the upload image through Bitmap class and you get such exception error? If yes, then the issue for me is that you are not specifying the correct constructor param to Bitmap class here:
To get the content of the uploaded file you should replace that line by this one:
HTH
pasluc7469
0 Points
12 Posts
Re: resize an Image sent by ajax
Nov 14, 2012 02:59 PM|LINK
That's perfect... thank you!!!