Guest User

Untitled

a guest
May 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <input type="file" name="data[FileUpload][file]" id="myFileToUpload">
  2. <a id="pickFile" href="#">Upload&nbsp;Now</a>
  3. <script type="text/javascript">
  4. $('#pickFile').click(function(e){
  5. e.preventDefault();
  6. $.post(
  7. "/admin/FileUploads/saveFromFlash/<?php e($session->id()) ?>",
  8. { data:$("#myFileToUpload").val() },
  9. function(data){
  10. $("#returnedContentFromAjax").html(JSON.stringify(data));
  11. },
  12. "json"
  13. );
  14. });
  15.  
  16. </script>
  17.  
  18. $this->FileUpload->save($this->data)
  19.  
  20. if (!isset($this->data['FileUpload']['file'])) {
  21. $this->setUploadError('No upload passed');
  22. return false;
  23. }
  24.  
  25. { data:$("#myFileToUpload").val() },
Add Comment
Please, Sign In to add comment