Home > Backend Development > PHP Tutorial > jQuery传递数据同时上传文件到php后台的问题

jQuery传递数据同时上传文件到php后台的问题

WBOY
Release: 2016-06-02 11:28:52
Original
838 people have browsed it

php数据jquery

各位大神们好,我是一名学生正在自学编程,一段手机上传图片程序如下:
1.前端有一个上传框,上传图片后会自动生成预览图
2.如下程序是部分js文件,一些无关的代码已经删掉了,
3.后台post.php页面用post方法或者file方法都收不到上传的文件,text文本数据可以收到
4.前端有获得 $("#picture").val() 的代码,我这个js是不是没有把文件传成功啊?少了点什么呢? 预览图可以正常生成!求大神们指点一二,小弟感激不尽!

<code> function postTopic(){    var cid = $('#cid').val();    if( parseInt(cid)  500 )    {        $('textarea[name=message]').focus();        return false;    }    var picture = "";    if( $("#picture").val() == "" )    {        if( msg.length </code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template