我在我的项目中使用 Google Chrome 的文件夹上传功能,如下所述: 如何在我自己的代码中使用 Google Chrome 11 的上传文件夹功能?
我有一个按钮,单击时会触发输入字段。我的问题是如何检查浏览器是否支持 webkitdirectory ?所以我可以隐藏我的按钮或提醒用户使用 chrome 来提供此服务。
<button>Upload Folder</button>
<input type="file" name="file[]" multiple webkitdirectory>
<script>
$("button").click(function(e) {
/* TODO: Detect webkitdirectory support */
if(webkitdirectory)
$('input').trigger('click');
else
alert('Use Chrome!');
});
</script>
Run Code Online (Sandbox Code Playgroud) 我有Ruby on Rails应用程序,我使用Carrierwave上传我的图像,但我需要一次上传多个图像.我找到一些jQuery插件(uploadify,image-uplad),但我不知道如何实现它到我的应用程序.我不需要庞大的app /引擎.
即使我使用下面的html选择多个文件.
<input type="file" id="multiplefiles" name="uploadedfile[]" multiple>
Run Code Online (Sandbox Code Playgroud)
我只获得第一个文件的值.我用的很简单:
var filelist = $("#multiplefiles").val() || [];
$.each(filelist, function(i, myfile) {
console.log('found file '+i+' ='+myfile);
});
Run Code Online (Sandbox Code Playgroud)
请告知我如何获得所有文件的列表...
例如,输入字段中选定的字符串是:C:\ Users\Public\Pictures\Sample Pictures\Hydrangeas.jpg,C:\ Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg,C:\ Users\Public\Pictures\Sample Pictures\upload-2.txt
从上面的逻辑我只得到:跟在日志中:
found file 0 =Hydrangeas.jpg
Run Code Online (Sandbox Code Playgroud)
TY.拉杰夫
我想使用testcafe. 它有几个步骤来上传文件。
在 HTML 代码中,输入 [type=file] 是隐藏的。HTML代码:
<div class="col-md-12">
<input type="button" class="btn btn-primary btn-exec" value="Select Files" id="fileBrowseBtn">
<input type="file" id="selectFiles" webkitdirectory="" style="display: none">
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下代码,但根本不起作用。
await t
.click(Selector('#fileBrowseBtn'))
.setNativeDialogHandler(() => true)
.setFilesToUpload(Selector('input').withAttribute('type','file'), [
'./uploads/1.jpg',
'./uploads/2.jpg',
'./uploads/3.jpg'
])
.setNativeDialogHandler(() => true)
.click(Selector('#uploadWizard').find('button').withText('Upload'))
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我提供可行的例子吗?我尝试了很多,但可能是我错过了一些东西。提前致谢。
javascript file-upload multifile-uploader e2e-testing testcafe
我正在开发一个网站,我需要一个客户端给我发送近千张图片.我们之间有一点地理距离,因此虽然邮寄CD或SD卡并非不可能,但并不是首选.我可以编写PHP上传器让客户提交图片,还是有更好的方法?我不想订阅任何文件共享站点.
假设我正在编写这样的上传器,有没有办法编写progresbar和/或其他一些功能,以防止被中断的上传文件损坏?
任何有助于资源的链接都是有益的.
谢谢
编辑:
这是一次性的事情,这些是我们正在讨论的高质量图像.它会是几GB.
通过FTP Space,你的意思是我的FTP服务器的用户名和密码?它可以完成,但(为什么)FTP客户端比基于Web的上传器更好?我不确定客户端是否知道如何下载FTP程序.客户端在Mac上,我不相信我见过的几个Mac的FTP程序.
假设我采用"单一拉链中的所有东西"路线,PHP会起作用吗?
再次感谢.
编辑:
好的,到目前为止,我已经确信不使用PHP,除非我们使用.zip文件.另外,我现在可能会修改进度条.等待客户,将在未来几天内回复所有人.
编辑:
遇到某种功能的客户端.客户端将照片放在闪存驱动器上.问题解决了.所有输入都是+1.
我有许多输入字段和primefaces组件的表单上传多个文件"p:fileUpload"当我提交表单时我无法获取上传的文件..管理的bean是"RequestScoped".那么如何在不制作manged bean View范围的情况下获取上传的文件呢?
上传方法
public void upload(FileUploadEvent event) {
try {
FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() + " is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
// Do what you want with the file
String thumbnail = getDestination() + event.getFile().getFileName();
int index = thumbnail.lastIndexOf('.');
SystemFile systemFile = new SystemFile();
systemFile.setAccount(getActor().getAccount());
systemFile.setName(event.getFile().getFileName());
systemFile.setPath(getTalentPath());
systemFile.setFileType(FileUtil.checkFileType(thumbnail.substring(index + 1)));
if (systemFiles == null) {
systemFiles = new ArrayList<>();
}
systemFiles.add(systemFile);
copyFile(event.getFile().getFileName(), event.getFile().getInputstream());
} catch (IOException ex) {
SystemLogger.getLogger(getClass().getSimpleName()).error(null, ex);
}
}
Run Code Online (Sandbox Code Playgroud)
主要组成部分
<p:fileUpload label="#{TalentMessages.lbl_Select_File}" fileUploadListener="#{talentPropertyAction.upload}"
mode="advanced" …Run Code Online (Sandbox Code Playgroud) 我正在升级到Sails.js版本0.10,现在需要使用Skipper来管理我的文件上传.
当我上传文件时,我使用UUID为它生成一个新名称,并将其保存在public/files /文件夹中(当我将这一切全部工作时会改变,但现在测试很好)
我将原始名称和上传的名称+路径保存到Mongo数据库中.
这一切都非常简单,Sails v0.9.x但使用Skipper我无法弄清楚如何读取新的文件名和路径.(显然,如果我能读到我可以构建路径的名称,那么它实际上只是我需要的名称)
我的控制器看起来像这样
var uuid = require('node-uuid'),
path = require('path'),
blobAdapter = require('skipper-disk');
module.exports = {
upload: function(req, res) {
var receiver = blobAdapter().receive({
dirname: sails.config.appPath + "/public/files/",
saveAs: function(file) {
var filename = file.filename,
newName = uuid.v4() + path.extname(filename);
return newName;
}
}),
results = [];
req.file('docs').upload(receiver, function (err, files) {
if (err) return res.serverError(err);
async.forEach(files, function(file, next) {
Document.create({
name: file.filename,
size: file.size,
localName: // ***** …Run Code Online (Sandbox Code Playgroud) 正在开发一个简单的文件上传程序。我必须使用 jakarta.servlet.* 类,因为我使用的是 Tomcat v10。我在 parseRequest(request) 行收到编译时错误。
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
ServletFileUpload sf = new ServletFileUpload(new DiskFileItemFactory());
try {
List<FileItem> multifiles = sf.parseRequest(request);
for(FileItem i : multifiles) {
i.write(new File("C:/Users/Luffy/Documents/FileUploadDemo/"+i.getName()));
}
response.getWriter().print("The file is uploaded");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
response.getWriter().print("The file is uploaded");
}
Run Code Online (Sandbox Code Playgroud)
错误如下:
ServletFileUpload 类型中的方法 parseRequest(javax.servlet.http.HttpServletRequest) 不适用于参数 (jakarta.servlet.http.HttpServletRequest)
我在谷歌上搜索了很多但找不到解决方案。
请提出解决方法或可能的解决方案。提前致谢。
这是我在 Stack Overflow 上的第一篇文章。所以请忽略我的错误(如果有的话):)
servlets multifile-uploader apache-commons-fileupload jakarta-ee tomcat10
在codeigniter 2中,我必须进行多文件上传.
在我看来,输入元素看起来像这样
<input type="file" name="file[]" id="file_1" />
<input type="file" name="file[]" id="file_2" />
<input type="file" name="file[]" id="file_3" />
<input type="file" name="file[]" id="file_4" />
<input type="file" name="file[]" id="file_5" />
<input type="file" name="file[]" id="file_6" />
Run Code Online (Sandbox Code Playgroud)
请帮忙我如何编写控制器来上传这些文件.. google了很多..在此先感谢
我正在使用jquery的插件来使用多文件上传来创建发送电子邮件的程序.
检查来源
http://www.fyneworks.com/jquery/multiple-file-upload/
我在这里下载了,我还没修改它......
我注意到你总共不能上传超过10MB,但是,你不能发送超过4MB的单个文件......
我已经被告知你可以发送超过10MB的文件,但是我的老板只是试图发送一个4.11MB的pdf文件,而且它不发送它....
我尝试通过Visual Studio发送它(这样我可以调试它,看看问题出在哪里......显然,一旦我附加文件并点击发送电子邮件......程序不会访问页面加载也不会按钮,它只是声明连接已重置...
如果您尝试发送(不使用Visual Studio,但来自互联网)...它会发送此错误
Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using …Run Code Online (Sandbox Code Playgroud) javascript ×4
file-upload ×3
jquery ×2
php ×2
asp.net ×1
c# ×1
carrierwave ×1
codeigniter ×1
e2e-testing ×1
file-sharing ×1
html ×1
jakarta-ee ×1
java ×1
jsf ×1
multifile ×1
primefaces ×1
sails.js ×1
servlets ×1
skipper ×1
spring ×1
testcafe ×1
tomcat10 ×1
uploader ×1
webkit ×1