我一直在试图以动态加载的格式实现一些文件上传软件包(raw php),其中一个页面上的潜在未知数目。我基本上都是从闪存基础上看待所有流行的闪存,但它们之间存在相同的问题。文件上传 - 多个实例
我正在尝试使用this。
我已经尝试过使用过的技巧,例如使用^=
在getelementbyid
和"\\S*"
以确保JavaScript使用相关的div id,但我没有成功。我也尝试给每个div添加一个类名,并使用getelementbyclass而没有成功。我已经搜索了一个解决方案,但我只是没有得到它。
要么我做错了,要么我完全失去了......我其实都是!
如果任何人都可以让我摆脱不幸的困境,或者让我朝着正确的方向发展,我会非常感激,因为我一直在寻找解决方案。
的HTML部分被呈现像这样:
<p id="upload" class="hidden"><label>Drag & drop not supported, but you can still upload via this input field:<br><input type="file"></label></p>
<p id="filereader">File API & FileReader API not supported</p>
<p id="formdata">XHR2's FormData is not supported</p>
<p id="progress">XHR2's upload progress isn't supported</p>
<p>Upload progress: <progress id="uploadprogress" min="0" max="100" value="0">0</progress></p>
<p>Drag an image from your desktop on to the drop zone above to see the browser both render the preview, but also upload automatically to this server.</p>
我打算通过PHP动态生成它成类似,其中$ INC是一个PHP变量在一个循环中,例如,ID =“的FileReader $ INC
的问题,我相信在这里的JavaScript将只处理预定义或上传的一个实例,直到修改,否则
如:的FileReader:的document.getElementById(“的FileReader”)
你能张贴somecode,了解问题更好一点? – 2013-04-07 08:17:38
嗯,似乎无法发布超过500个字符在这里,但与我试图使用的代码链接在这里:http://nghiadh.info/blog/html5-drag-and-drop-and- xhr-upload-34.html – 2013-04-07 08:49:35
问题是我想动态创建html div id,但javascript只能用于一个实例,例如filereader:document.getElementById('filereader')...我需要实现像filereader:document.getElementById('filereader *')如果你知道我的意思吗? – 2013-04-07 08:53:49