form表单上传图片-提交给php方法,成功后想返回前台一些值,但前台始终无法获取到参数值。急!!!

WBOY
Release: 2016-06-02 11:31:12
Original
1215 people have browsed it

php图片表单upload

form表单部分代码:以此来实现form提交页面不跳转。

<code> <form action="user.php" method="post" enctype="multipart/form-data" target="id_iframe">                <input name="upfile" type="file" id="upfile">                <input name="act" type="hidden" value="uploadcardno">                <input type="submit" name="submit" id="upload" value="上传文件">            </form>            <iframe id="id_iframe" name="id_iframe" style="display:none;"></iframe></code>
Copy after login

php方法:图片上传成功或失败,想返回图片的路径和报错信息。传值方式如下
$cardnoimg = $destination_folder; -- 图片路径
$smarty->assign('cardnoimg', $cardnoimg); -- 传入dwt模版页
$smarty->assign('mag', $mag); --错误信息传入dwt模版页
现在有两个问题
1:我想用JS来获取图片路径,并赋值给一个隐藏的文本框。那么这个方法应该在什么地方去写呢?在form的onsubmit方法里写不合适吧?
2:就是我php应该怎么写才能让dwt模版中读取到这些值呢?
本人菜鸟,请大神详细说明。

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