如何使用Uppy上传

时间:2019-05-23 21:05:54

标签: javascript php json xmlhttprequest

我想用Uppy制作File Uploader。 但是我上载时遇到问题。

问题是:

当您进入控制台时,将出现错误。

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{
      return NO; // return NO to not become first responder
      }

谢谢

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.getResponseData (settle.js:3)
    at XMLHttpRequest.<anonymous> (settle.js:3)

JavaScritp代码

// upload.php
<?php
$my_file = $_FILES['my_file'];
$file_path = $my_file['tmp_name']; // temporary upload path of the 
file
$file_name = $_POST['name']; // desired name of the file
move_uploaded_file( $file_path, './img/' . basename( $file_name ) 
); // save the file at `img/FILE_NAME`

0 个答案:

没有答案