On Jan 9, 2013, at 3:45 PM, Jason Westbrook wrote:
> It is possible but you have to realize it will only work on browsers that have the FileAPI available - Chrome/Firefox/Safari
>
>
> new Ajax.Request("fileupload.php?filename=myfile",{"postBody":$("inputfield").files[0]});
>
> will post the contents of the file to fileupload.php
>
> then you can use
>
> file_get_contents("php://input");
Note that this style of upload will not have the same security treatment by PHP as the $_FILES superglobal variable, and move_uploaded_file() and friends will not be active for it either. This can become an awful security hole if you aren't careful.
>
> to get the contents of the file
>
> and the filename will be $_GET['filename']
>
>
If you want to use the normal upload mechanism, you can use a "keyhole" iframe as the target in your form action to post your file contents normally, and a callback function in the window scope of the containing page to signal back your updates. It looks like Ajax, but it's really just a multipart form post.
Walter
> To post to this group, send email to
prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to
prototype-scripta...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "Prototype &
script.aculo.us" group.
> To post to this group, send email to
prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to
prototype-scripta...@googlegroups.com.