我使用了jQuery多文件上传控件[来自fyneworks的MultiFile http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview ]来收集一些文件名,但无法解决如何上传它们在服务器上.
标准的asp:FileUpload控件似乎只允许单个文件,我不想使用swfupload控件,只是普通的旧aspx.
我正在使用这里找到的jQuery多文件上传插件:http:
//www.fyneworks.com/jquery/multiple-file-upload/
我没有在任何一个例子中看到通过"重置"文件选择器的方法,清除任何当前选择的项目.
有人知道怎么做吗?谢谢!
我得到了这个厨房约占我想要它的65%.我想知道是否有人可以查看以下代码并告诉我如何将多个图像上传到我的图库.
这是代码.
简单的管理表单代码:
<form enctype="multipart/form-data" action="uploader.php" method="POST">
Category: <select class="text" name="dataType[]">
<option value="treeremoval" selected="selected">treeremoval</option>
<option value="treetrimming" >treetrimming</option>
<option value="treebracing" >treebracing</option>
<option value="stumpgrinding" >stumpgrinding</option>
<option value="firewood" >firewood</option>
<option value="cleanup" >cleanup</option>
</select>
<br /><br />
Caption: <input type="text" name="title[]">
<br /><br />
Image to upload: <input type="file" name="image[]" />
<br /><br />
Category: <select class="text" name="dataType[]">
<option value="treeremoval" selected="selected">treeremoval</option>
<option value="treetrimming" >treetrimming</option>
<option value="treebracing" >treebracing</option>
<option value="stumpgrinding" >stumpgrinding</option>
<option value="firewood" >firewood</option>
<option value="cleanup" >cleanup</option>
</select>
<br /><br />
Caption: <input type="text" name="title[]"> …Run Code Online (Sandbox Code Playgroud) 我无法弄清楚如何使用 req.body.fname 作为文件的名称,甚至尝试使用中间件但 req.body 为空。
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, path);
},
filename: function (req, file, cb) {
cb(null, req.body.fname) // undefined
}
})
var upload = multer({ storage: storage })
app.get('/upload', upload.single('fname'), (req,res)=>{
.......
})
i m unable to figure out how to fetch fname in fileNameRun Code Online (Sandbox Code Playgroud)
index.html
<form action="/upload" method="POST" enctype= "multipart/form-data">
<input type="text" name="fname">
<input type="file" name="pic">
<input type = "submit">
</form>Run Code Online (Sandbox Code Playgroud)
嗨,我正在使用fineupload多文件上传脚本,但有一些我无法掌握.我正在尝试制作一个php服务器端文件处理脚本.
当你包括
<script type="text/javascript">
$(document).ready(function() {
var uploader = new qq.FileUploader({
element: $('#manualUploadModeExample')[0],
action: "core/up.php",
autoUpload: false,
demoMode: false,
debug: false,
multiple: true,
maxConnections: 3,
disableCancelForFormUploads: false,
//0 is geen limit getal in bytes
minSizeLimit: 0,
sizeLimit: 0,
inputName: "qqfile",
uploadButtonText: "Select Files",
cancelButtonText: "verwijder",
failUploadText: "Upload mislukt"
});
$('#triggerUpload').click(function() {
uploader.uploadStoredFiles();
});
});
Run Code Online (Sandbox Code Playgroud)
显示它的HTML
<div id="Upload">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
<!-- or put a simple form for upload here -->
</noscript>
<ul id="manualUploadModeExample" …Run Code Online (Sandbox Code Playgroud) 我正在使用 dropzone 将图像上传到图库。我通过按钮提交。是否可以防止两次添加相同的文件?我不确定是否检查名称或名称和大小。这是我的代码:
<script>
var i = 0;
Dropzone.options.myDropzone = {
init: function() {
this.on("addedfile", function(file) {
i=++i;
Run Code Online (Sandbox Code Playgroud)
在此处检查其他文件的文件名和文件大小
----------->if(){
myDropzone.removeFile(file);
}
var inputs = Dropzone.createElement('<div class="dz-image-metadata"><label for="'+i+'_title">Nazov</label><input type="hidden" name="'+i+'_filename" value="'+file.name+'"><input type="text" name="'+i+'_title" value="'+file.name+'" /><label for="">Popis</label><input type="text" name="'+i+'_desc"></div>');
file.previewElement.appendChild(inputs);
var removeButton = Dropzone.createElement("<button class=\"dz-button\">Vymaza?</button>");
var _this = this;
removeButton.addEventListener("click", function(e) {
e.preventDefault();
e.stopPropagation();
i=--i;
_this.removeFile(file);
});
file.previewElement.appendChild(removeButton);
});
var myDropzone = this;
$("#submit-all").click(function (e) {
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
i=0;
}
);
this.on("successmultiple", function(files, response) {
console.log(response);
});
this.on("complete", function(file) { …Run Code Online (Sandbox Code Playgroud) 我在我的一个客户的网站上使用Uploadify,允许他们一次将大量图片上传到他们的照片库.
我最近看到了问题.他们似乎上传大型照片(3 MB及以上).我想知道,是否有可能在客户端压缩(减小它们的大小),而不是在服务器上进行(就像facebook那样).我知道我可以轻松地在服务器上执行此操作,但我现在正在处理另一个项目,我期待大量的照片上传.它需要大量的CPU时间来处理它们.所以我想,我会问客户端处理.
谢谢.
我正在使用jquery文件上传器(每个blueimp),我想知道如何将回发指向特定的http帖子,而不是index.cshtml(默认情况下会发布到index.cshtml)?
例如,在调用Home/Bulk时...然后在选择文件后,回发默认为[httppost] index.cshtml()...如何将其指向[httppost] bulk.cshtml()?谢谢!
查看(Bulk.cshtml):
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.widget.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.iframe-transport.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.fileupload.js")" type="text/javascript"></script>
@using (Html.BeginForm("Bulk", "Home")) // I want this to direct back to httppost:bulk handler
{
<input id="fileupload" type="file" name="files" multiple="multiple"/>
}
Run Code Online (Sandbox Code Playgroud)
控制器:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(IEnumerable<HttpPostedFileBase> files)
{
foreach (var file in files)
{
var filename = Path.Combine(Server.MapPath("~/App_Data"), file.FileName);
file.SaveAs(filename);
}
return View();
}
public ActionResult Bulk()
{
return View();
}
[HttpPost] …Run Code Online (Sandbox Code Playgroud) asp.net-mvc jquery file-upload multifile-uploader asp.net-mvc-3
我知道如何在djnago中多文件上传.我用:
<form enctype="multipart/form-data" action="" method="post">
{% csrf_token %}
<p>Press control to upload more than image at same time</p>
<input type="file" name="myfiles" multiple>
<input type="submit" name="upload" value="Upload">
</form>
Run Code Online (Sandbox Code Playgroud)
但我想要的是单个文件上传,但允许用户点击"+"按钮并自动创建新的文件上传,允许用户上传多个文件.喜欢在hotmail中附加文件.
如何使用PHP和数据库进行jQuery-File-Upload?我想在上传或删除图像时插入或删除有关图像的行,并且每个图像的名称在上传到目录时都是time().
我通过谷歌找到的所有结果告诉我,我需要编辑upload.class.php,但最后一个版本只有index.php和UploadHandler.php ...
文件UploadHandler.php包含带有代码的类UploadHandler
public function post($print_response = true) {
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
return $this->delete($print_response);
}
$upload = isset($_FILES[$this->options['param_name']]) ?
$_FILES[$this->options['param_name']] : null;
// Parse the Content-Disposition header, if available:
$file_name = isset($_SERVER['HTTP_CONTENT_DISPOSITION']) ?
rawurldecode(preg_replace(
'/(^[^"]+")|("$)/',
'',
$_SERVER['HTTP_CONTENT_DISPOSITION']
)) : null;
$file_type = isset($_SERVER['HTTP_CONTENT_DESCRIPTION']) ?
$_SERVER['HTTP_CONTENT_DESCRIPTION'] : null;
// Parse the Content-Range header, which has the following form:
// Content-Range: bytes 0-524287/2000000
$content_range = isset($_SERVER['HTTP_CONTENT_RANGE']) ?
preg_split('/[^0-9]+/', $_SERVER['HTTP_CONTENT_RANGE']) : null;
$size = $content_range …Run Code Online (Sandbox Code Playgroud) jquery ×6
file-upload ×4
php ×3
ajax ×1
asp.net ×1
asp.net-mvc ×1
blueimp ×1
c# ×1
clear ×1
django ×1
django-forms ×1
dropzone.js ×1
javascript ×1
multer ×1
mysql ×1
node.js ×1
python ×1
reset ×1
uploadify ×1
validation ×1