简体   繁体   English

jQuery ajax文件上传,要发送的参数

[英]jquery ajax file upload , parameters to be sent

<form action="upload_file.php" method="post" enctype="multipart/form-data">

Above is the line for a form to upload a file using php. 上面是使用php上传文件的表单行。

If i use the form as I wrote above I can get the various properties of the file to be uploaded from upload_file.php page. 如果我使用上面写的表格,则可以从upload_file.php页面获取要上传文件的各种属性。

Using jquery $.post , how can I do the same thing in upload_file.php ? 使用jquery $ .post,如何在upload_file.php中做同样的事情?

I googled but can't find the exact snippet of code necessary here. 我用谷歌搜索,但在这里找不到所需的确切代码片段。

Uploading images using jquery's ajax methods is a pain, generally involving dynamically creating an iframe and submitting a form inside it. 使用jquery的ajax方法上传图像是一件很痛苦的事情,通常涉及动态创建iframe并在其中提交表单。 I usually use this plugin: http://plugins.jquery.com/project/jquery-upload 我通常使用此插件: http : //plugins.jquery.com/project/jquery-upload

You can write some php to echo the uploaded image data as a json object, which you can access once the upload is complete through the plugin. 您可以编写一些php来将上传的图像数据作为json对象回显,一旦通过插件完成上传,就可以访问它。

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

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