简体   繁体   English

使用php在ajax中上传文件

[英]file upload in ajax by using php

I wud like to use file upload(ajax/javascript with php) in my form that has other controls also. 我想在具有其他控件的表单中使用文件上载(ajax / javascript和php)。 when i uploaded an img it displays on the same form with delete option. 当我上载img时,它以删除选项显示在同一表格上。 if i click on submit it goes into folder as well as database & if i click on delete it deletes an img.... anybody can help me?pls u knw gmail file upload exact like that 如果我单击提交,它会进入文件夹以及数据库,如果我单击删除,它会删除img ....有人可以帮助我吗?

It boils down to "Don't use XHR. Do use Flash or iframes". 归结为“不要使用XHR。请使用Flash或iframe”。 There are libraries that will do the heavy lifting for you . 有一些库可以为您完成繁重的工作

Just use jQuery ajax upload plugin http://valums.com/ajax-upload/ . 只需使用jQuery ajax上传插件http://valums.com/ajax-upload/即可 It is actually not ajax, it's invisible iframe, but result is almost same. 它实际上不是ajax,它是不可见的iframe,但结果几乎相同。

For server-side you can use php with gd-library and some simple MySQL queries. 对于服务器端,您可以将php与gd-library和一些简单的MySQL查询一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM