0

Rather than using a Handler(.ashx), is it possible to use a web service(.asmx) to upload?

Any suggestions on how to use a jQuery upload to get the input stream?

VB.NET code or examples would be appreciated.

1

2 Answers 2

1

Yes it is possible , you can pass the File to the service(.asmx) , and get Json back by specifing the response type. better soultion if you want a simple uploader with drag and drop functionality would be Ajax uploader - valums

_uploader = new qq.FileUploader({
                element: document.getElementById(_Uploaddiv),
                onComplete: function (id, fileName, responseJSON) {  },
                action: '/Uploader.asmx/functionName',
                params: {
                    startRowIndex:_startRowIndex,
                    pageSize:_pageSize
                }

    xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    xhr.setRequestHeader("Accept", "application/json, text/javascript, */*; q=0.01");

set the XMLHttpRequest() headers to Accept json

VB code

<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _

Simple , light, accepts my CSV and gets me the result. that's what i wanted

Sign up to request clarification or add additional context in comments.

Comments

0

Jquery has a Forms plugin which can be used for this purpose. The good thing about it, it supports file upload using AJAX as well.You can locate it here http://plugins.jquery.com/project/form. We are using it with MVC 3.

Prasad Pimparkar

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.