我们如何使用Ajax传输图像文件 [英] How can we transfer image file using ajax

查看:83
本文介绍了我们如何使用Ajax传输图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我们如何将图像文件从上载按钮传输到数据库mysql,并获取图像并将其显示在ajax中的同一页面上

Helo,

how can we transfer image file from upload button to the database mysql and retreive the image and display it on the same page

推荐答案

,您可能没有机会上传一个文件.但是使用javascript可以做到这一点:

in ajax you may not have the opportunity to upload a file. but With javascript you can this is how you can do:

<form name=fileuploader id=fileuploader method=post action='upload_handle.ext' enctype="multipart/form-data" target='UploadedFrame'>
<input type='file' name='csv' id='csv' onchange='document.getElementById("fileuploader").submit()' Title='Select File Name'>

</form>
<iframe id='UploadedFrame' name='UploadedFrame' style='display:none'></iframe>



使用HTML5,您还可以处理尺寸和其他问题



with HTML5 you can also work with size and other issues


这篇关于我们如何使用Ajax传输图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆