{"action":"created","issue":{"url":"https://api.github.com/repos/think2011/localResizeIMG/issues/94","repository_url":"https://api.github.com/repos/think2011/localResizeIMG","labels_url":"https://api.github.com/repos/think2011/localResizeIMG/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/think2011/localResizeIMG/issues/94/comments","events_url":"https://api.github.com/repos/think2011/localResizeIMG/issues/94/events","html_url":"https://github.com/think2011/localResizeIMG/issues/94","id":143776433,"number":94,"title":"后端能直接接收压缩后的图片路径么","user":{"login":"yanluan","id":12733507,"avatar_url":"https://avatars.githubusercontent.com/u/12733507?v=3","gravatar_id":"","url":"https://api.github.com/users/yanluan","html_url":"https://github.com/yanluan","followers_url":"https://api.github.com/users/yanluan/followers","following_url":"https://api.github.com/users/yanluan/following{/other_user}","gists_url":"https://api.github.com/users/yanluan/gists{/gist_id}","starred_url":"https://api.github.com/users/yanluan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanluan/subscriptions","organizations_url":"https://api.github.com/users/yanluan/orgs","repos_url":"https://api.github.com/users/yanluan/repos","events_url":"https://api.github.com/users/yanluan/events{/privacy}","received_events_url":"https://api.github.com/users/yanluan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-27T04:42:04Z","updated_at":"2016-03-27T14:25:50Z","closed_at":null,"body":"后端处理不想接收base64格式，只想获取一个临时路径通过普通图片上传格式上传，要怎么处理\r\n类似move_uploaded_file($_FILES[\"photo\"][\"tmp_name\"],\"upload/\".time());，这样来上传的"},"comment":{"url":"https://api.github.com/repos/think2011/localResizeIMG/issues/comments/202072002","html_url":"https://github.com/think2011/localResizeIMG/issues/94#issuecomment-202072002","issue_url":"https://api.github.com/repos/think2011/localResizeIMG/issues/94","id":202072002,"user":{"login":"yanluan","id":12733507,"avatar_url":"https://avatars.githubusercontent.com/u/12733507?v=3","gravatar_id":"","url":"https://api.github.com/users/yanluan","html_url":"https://github.com/yanluan","followers_url":"https://api.github.com/users/yanluan/followers","following_url":"https://api.github.com/users/yanluan/following{/other_user}","gists_url":"https://api.github.com/users/yanluan/gists{/gist_id}","starred_url":"https://api.github.com/users/yanluan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanluan/subscriptions","organizations_url":"https://api.github.com/users/yanluan/orgs","repos_url":"https://api.github.com/users/yanluan/repos","events_url":"https://api.github.com/users/yanluan/events{/privacy}","received_events_url":"https://api.github.com/users/yanluan/received_events","type":"User","site_admin":false},"created_at":"2016-03-27T14:25:50Z","updated_at":"2016-03-27T14:25:50Z","body":"能否指导一下,灰常感谢\r\n\r\n我的代码\r\nhtml\r\n<input id=\"upFile\" class=\"up-file\" type=\"file\" name=\"file\">\r\njs\r\n\r\n//图片上传\r\nvar base64;\r\nvar $oImage =$('#preview');\r\n    var $upFile = $('#upFile');\r\n    $upFile.on('change',function(){\r\n       var $this = $(this);\r\n      //console.log(this.files[0])\r\n      lrz(this.files[0])\r\n        .then(function (rst) {\r\n            // 处理成功会执行\r\n         base64 = rst;\r\n\r\n         console.log('处理成功会执行')\r\n         //console.log(rst)\r\n         \r\n         $.ajax({\r\n            type:\"POST\",          \r\n            url:\"action.php\",    \r\n            data:{photo:base64.upFile},\r\n            success:function(data){\r\n               console.log(\"成功了\")\r\n               $oImage.attr('style','background-image:url(' + base64.base64 +')')\r\n                   \r\n            },\r\n            error:function(){\r\n               console.log(\"失败\")\r\n            }\r\n         })\r\n         \r\n         \r\n        })\r\n        .catch(function (err) {\r\n            // 处理失败会执行\r\n         //console.log('处理失败会执行')\r\n        })\r\n        .always(function () {\r\n            // 不管是成功失败，都会执行\r\n      //console.log('不管是成功失败，都会执行')\r\n        });\r\n  action.php 不太清楚接收的参数是要写file，还是photo了\r\nmove_uploaded_file($_FILES[\"file\"][\"tmp_name\"],\"upload/\".time());\r\n    虽然前端能预览压缩，但是后端接收不到路径\r\n"}}