tag:blogger.com,1999:blog-865923359735383241.post3784017211635362372..comments2023-10-29T07:27:09.012-06:00Comments on Ccna final exam - java, php, javascript, ios, cshap all in one: Is it possible to upload file via $.ajax(options) or xhr.send(file) only?Unknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-865923359735383241.post-44688682643896656592012-04-08T20:42:27.946-06:002012-04-08T20:42:27.946-06:00Whenever you are dealing with uploading arbitrary ...Whenever you are dealing with uploading arbitrary data from a users machine, the answer is usually "no, and if you can, that's a bug".<br><br>This strikes me as something that would fall under the umbrella of security violations. You can't change the value of the file input control or do many other things to it including read the true path of the file or its contents. Furthermore, on some platforms you don't have even the file size (IE, I'm looking at you) without some security dialog popping up (via an activex control). Given all of these problems I would probably be tempted to say that even if you did find a solution, it would be potentially viewed as a bug in the future and removed or changed. <br><br>In other words, I don't think it's a safe thing to do unless you find a reputable source explicitly supporting it ... like the chromium dev blog.Tips For Allhttp://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-15122157282907745052012-04-08T20:42:27.220-06:002012-04-08T20:42:27.220-06:00I my self have used valums ajax uploader. You can ...I my self have used valums ajax uploader. You can get it from here:<br>http://valums.com/ajax-upload/. It works pretty nicely. I don't know the exact implementation details, but here's a very short description:<br><br>"This plugin uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+, Chrome and falls back to hidden iframe based upload in other browsers, providing good user experience everywhere."<br><br>So it sounds like its very close to what you want. Here's another bit of info describing the way it works from the servers point of view (from server/readme.txt):<br><br><br>For IE6-8, Opera, older versions of other browsers you get the file as<br>you normally do with regular form-base uploads.<br>For browsers which upload file with progress bar, you will need to get the raw<br>post data and write it to the file.<br><br><br>So it requires special handling on the server side. Luckily it comes with several reference server side implementations (perl, php and java) so that shouldn't be too much of hassle. Happy ajax uploading :)Tips For Allhttp://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-51701791946257119162012-04-08T20:42:26.599-06:002012-04-08T20:42:26.599-06:00Cross browser support for Ajax (like) file upload ...Cross browser support for Ajax (like) file upload with progress is damn near impossible.<br><br>I usually use SWFUpload. <br><br>I know, it's flash, but it works. The only browsers that it will always fail for are Apples mobile browsers, but they don't support uploads anyway.Tips For Allhttp://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-92087240778503370062012-04-08T20:42:25.964-06:002012-04-08T20:42:25.964-06:00How can I upload files asynchronously with JQuery?...How can I upload files asynchronously with JQuery?<br><br>And hey! Bam. Instant expert. <br><br>It seems you can't do this without going through an iFrame. There seem to be working snippets in the answer i linked, and several plugins that do it for you.Tips For Allhttp://www.blogger.com/profile/11557173689529910046noreply@blogger.com