Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems uploading pictures from camera capture with input type="file" capture="camera" using JQM -> Ajax -> Asp.net [WebMethod]
    primarykey
    data
    text
    <p>Problems uploading pictures from camera capture <code>&lt;input type="file" capture="camera"</code> using JQM, Ajax, Asp.net [WebMethod].</p> <p>I'll post some code below:</p> <p>Script:</p> <pre><code>$('#uploadpicture').click(function() { var fd = new FormData(); fd.append('photo', $('#filefromcam')[0].files[0]); $.ajax({ url: "Butikk.aspx/UploadPicture", type: "POST", data: fd, processData: false, // tell jQuery not to process the data contentType: false, // tell jQuery not to set contentType success: function (data) { var result = data.d; console.log(data.d); }, error: function (xhr, errorType, exception) { //Triggered if an error communicating with server var errorMessage = exception || xhr.statusText; alert("Feilmelding: " + errorMessage); } }); }); </code></pre> <p>HTML:</p> <pre><code>&lt;td&gt; &lt;input type="file" id="filefromcam" capture="camera" accept="image/*" data-mini="true"&gt; &lt;/td&gt; &lt;td&gt; &lt;a data-role="button" id="uploadpicture" data-mini="true"&gt;Last opp&lt;/a&gt; &lt;/td&gt; </code></pre> <p>FORM TAG IN MASTER PAGE:</p> <pre><code>&lt;form id="form" runat="server" enctype="multipart/form-data"&gt; </code></pre> <p>WEBMETHOD BACK-END</p> <pre><code>[WebMethod] public static void UploadPicture(object fd) { var test = "test"; // just to see if debug mode occurs for breakpoint. } </code></pre> <p>The thing is, I always get POST localhost.../UploadPicture 200 OK 63MS so it seems to be working, but I never get to the breakpoint I'm setting in the [WebMethod].</p> <p>I have also tried XHR like this : </p> <pre><code>var file = input.files[0]; var form = new FormData(); xhr = new XMLHttpRequest(); form.append('image', file); xhr.open('post', 'TestTest(dot)aspx/UploadPicture', true); xhr.send(form); </code></pre> <p>This should have been a solution too, but I just cannot get any other results no matter what i do or change.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload