code_junkie

JQuery Flickr file upload not working

Nov 11th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <title>Test Upload</title>
  5. <script type="text/javascript" src="jquery-1.2.6.js"></script>
  6. <script type="text/javascript" src="jquery.form.js"></script>
  7. <script type="text/javascript">
  8. $(document).ready(function() {
  9. $('#myForm').bind('submit', function() {
  10. $(this).ajaxSubmit({
  11. dataType: 'xml',
  12. success: processXml
  13. });
  14. return false; // <-- important!
  15. });
  16. });
  17.  
  18. function processXml(responseXML) {
  19. var message = $('message', responseXML).text();
  20. document.getElementById('output').innerHTML = message;
  21. }
  22.  
  23. </script>
  24.  
  25. </head>
  26.  
  27. <body>
  28.  
  29. <form id="myForm" method="post" action="http://api.flickr.com/services/upload/" enctype="multipart/form-data">
  30. <input type="file" name="photo" id="photo"/>
  31. <input type="text" name="api_key" id="api_key" value="..snip.."/>
  32. <input type="text" name="auth_token" id="auth_token" value="..snip.."/>
  33. <input type="text" name="api_sig" id="api_sig" value="..snip.."/>
  34. <input type="submit" value="Upload"/>
  35. </form>
  36. <div id="output">AJAX response will replace this content.</div>
  37. </body>
  38.  
  39. </html>
  40.  
  41. <rsp stat="fail">
  42.  
  43. <err code="100" msg="Invalid API Key (Key not found)" />
  44.  
  45. </rsp>
Add Comment
Please, Sign In to add comment