我在找一個沒有flash的JQuery或ajax文件上傳器。 我不是很瞭解html,ajax和jQuery。 所以請幫助我。 我想要我的功能的代碼。AJAX jQuery上傳器
0
A
回答
0
我用valums/file-uploader,我很滿意它。
它很容易使用。
你可以找到我的一些關於這個工具的答案here和here。
HTML:
<div id="uploaderFile"></div>
的Javascript:
function CreateImageUploader() {
var uploader = new qq.FileUploader({
element: $('#uploaderFile')[0],
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
'<div class="qq-upload-button ui-button ui-widget ui-corner-all ui-button-text-only ui-state-default">Seleziona il Listino Excel</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
hoverClass: 'ui-state-hover',
focusClass: 'ui-state-focus',
action: 'Home/UploadImage',
allowedExtensions: ['jpg', 'gif'],
params: { },
onSubmit: function(file, ext) {
},
onComplete: function(id, fileName, responseJSON) {
$("#PopupImageUploader").dialog('close');
}
}
});
}
0
@Prasad 007替換下面的代碼在doajaxfileupload.php而在這之前創建文件夾 「上傳」 文件夾「 AjaxFileUploaderV2.1「
<?php
$error = "";
$msg = "";
$fileElementName = 'fileToUpload';
if(!empty($_FILES[$fileElementName]['error']))
{
switch($_FILES[$fileElementName]['error'])
{
case '1':
$error = 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
break;
case '2':
$error = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
break;
case '3':
$error = 'The uploaded file was only partially uploaded';
break;
case '4':
$error = 'No file was uploaded.';
break;
case '6':
$error = 'Missing a temporary folder';
break;
case '7':
$error = 'Failed to write file to disk';
break;
case '8':
$error = 'File upload stopped by extension';
break;
case '999':
default:
$error = 'No error code avaiable';
}
}elseif(empty($_FILES['fileToUpload']['tmp_name']) || $_FILES['fileToUpload']['tmp_name'] == 'none')
{
$error = 'No file was uploaded..';
}else
{
if (file_exists("upload/" . $_FILES["fileToUpload"]["name"]))
{
$msg .= $_FILES["fileToUpload"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],
"upload/" . $_FILES["fileToUpload"]["name"]);
$msg .= "Stored in: " . "upload/" . $_FILES["file"]["name"];
$msg .= " File Name: " . $_FILES['fileToUpload']['name'] . ", ";
$msg .= " File Size: " . @filesize($_FILES['fileToUpload']['tmp_name']);
}
//for security reason, we force to remove all uploaded file
//@unlink($_FILES['fileToUpload']);
}
echo "{";
echo "error: '" . $error . "',\n";
echo "msg: '" . $msg . "'\n";
echo "}";
?>
相關問題
- 1. 拖放jQuery Ajax上傳
- 2. jQuery的AJAX文件上傳
- 3. JQuery Ajax上傳文件
- 4. codeigniter jquery ajax文件上傳
- 5. 上傳文件jQuery ajax MVC
- 6. jQuery ajax圖片上傳
- 7. Django ajax jquery文件上傳
- 8. Jquery/Ajax文件上傳
- 9. jQuery的AJAX文件上傳
- 10. Ajax上傳與JQuery和PHP
- 11. jQuery的Ajax表單上傳
- 12. 的jQuery/AJAX - 文件上傳
- 13. 圖片上傳ajax jquery
- 14. jquery Ajax PHP文件上傳
- 15. 附上valums jquery ajax上傳到元素
- 16. Ajax文件上傳器
- 17. Node.js AJAX文件上傳器
- 18. AJAX圖像上傳器
- 19. 上傳沒有特殊ajax上傳器的進度指示器?
- 20. 上傳文件使用Ajax,Jquery和Struts2
- 21. JQuery的AJAX文件上傳錯誤500
- 22. 使用ajax,jquery,php上傳文件
- 23. 使用jQuery Ajax和PHP上傳文件
- 24. jQuery/AJAX圖片上傳插件?
- 25. Django的jQuery的ajax圖像上傳
- 26. 的CherryPy + jQuery的AJAX文件上傳
- 27. jquery ajax文件上傳,成功不叫
- 28. 通過ajax上傳文件jquery php api
- 29. jquery ajax文件上傳問題
- 30. 圖片上傳不能使用JQuery/ajax
@Dinesh我照你的意思告訴了我,但是它顯示了同樣的錯誤。 – Prasad007
它只顯示「語法錯誤」 – Prasad007
沒有進出口直接 – Prasad007