fileupload

fileupload上传图片

天大地大妈咪最大 提交于 2019-12-03 16:55:49
<asp:FileUpload ID="FileUpload1" runat="server" accept="image/*" />    HttpFileCollection upFiles = Request.Files; if (upFiles.Count > 0 && upFiles.Count < 2) { string wenjianjia = "a_" + DateTime.Now.ToString("yyyy-MM-dd"); string savePath = "/plugins/dangxingtijian/PC/face/img/" + wenjianjia; string savePaths = MapPath(savePath); if (!Directory.Exists(savePaths)) { Directory.CreateDirectory(savePaths); } for (int i = 0; i < upFiles.Count; i++) { string url_a = "a" + DateTime.Now.Ticks.ToString() + i; string url_f = "f" + DateTime.Now.Ticks.ToString() + i; string extendName = string.Empty;

FileUpload empty after PostBack

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem regarding a ASP.NET fileuploader that is empty after postback. I have one fileupload control, one textbox control and one button control. When I click the button, it checks if the textbox is populated, if it is it performs actions, if its not then it shows an error message and stay on the page. However, when I press the button and the textbox is empty, the button postsback and the fileuploader is empty and the user has to select the file again. So: User selects file > The file is located in the fileuploader > the user

blueimp jquery file upload Empty file upload result struts2, fileitems empty

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Blueimp and server side is Java, Struts2. I couldn't find examples using Java, anyway I managed to use the sample code, but I am getting "Empty file upload result" when I am trying to upload a single file also. The HTML part is the same, I am not pasting here as it may go lengthy. The jQuery is: $(document).ready(function () { 'use strict'; // Initialize the jQuery File Upload widget: $('#fileupload').fileupload(); // Enable iframe cross-domain access via redirect option: $('#fileupload').fileupload( 'option', 'redirect', window

Apache Commons fileUpload实现文件上传

荒凉一梦 提交于 2019-12-03 05:09:08
找了好久,才找到的,很实用 将 Apache 的 commons-fileupload.jar 放在应用程序的 WEB-INF\lib 下 , 即可使用。下面举例介绍如何使用它的文件上传功能。 所使用的 fileUpload 版本为 1.2 ,环境为 Eclipse3.3+MyEclipse6.0 。 FileUpload 是基于 Commons IO 的,所以在进入项目前先确定 Commons IO 的 jar 包(本文使用 commons-io-1.3.2.jar )在 WEB-INF\lib 下。 此文作示例工程可在文章最后的附件中下载。 示例 1 最简单的例子,通过 ServletFileUpload 静态类来解析 Request ,工厂类 FileItemFactory 会对 mulipart 类的表单中的所有字段进行处理,不只是 file 字段。 getName ()得到文件名, getString ()得到表单数据内容, isFormField ()可判断是否为普通的表单项。 demo1.html < html > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=GB18030" > < title > File upload </ title > </ head >

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm developing a servlet that receives a multipart request with content of multiple files, and I'm using apache commons file upload libraries. When I call parseRequest(request); method servlet throws following exception: GRAVE: Servlet.service() for servlet DiffOntology threw exception java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest at org.apache.commons.fileupload.servlet.ServletRequestContext.getContentType(ServletRequestContext.java:73) at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.

Could not parse multipart servlet request, nested exception is org.apache.commons.fileupload.FileUploadException

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting error when i uploading 10 MB Size of csv file in Spring by using CommonsMultipartResolver library. I have done following setting in xml file Xml File Confi : <beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <!-- max upload size in bytes --> <beans:property name="maxUploadSize" value="99971520" /> <!-- 99MB --> <!-- max size of file in memory (in bytes) --> <beans:property name="maxInMemorySize" value="1048576" /> <!-- 1MB --> Controller Code: @RequestMapping(value="

Apache commons fileupload FileItemIterator hasNext() returns false

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the apache commons fileupload stream api. But the FileItemIterator FileItemIterator iter = upload.getItemIterator(request); returns false in its hasNext() iter.hasNext() What is wrong with this? The code and the web part is as follows: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { /** * Apache commons file upload method will be used */ // Check that we have a file upload request boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (isMultipart) { try { //

Ajax FileUpload &amp; JQuery formData in ASP.NET MVC

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some problem with posting formData to server side action method. Because ajax call doesn't send files to server, I have to add file uploader data to formData manually like this: var formData = new FormData(); formData.append("imageFile", $("#imageFile").file); formData.append("coverFile", $("#coverFile").file); I wrote jQuery function that need to post form data to server using ajax call. It's works but posted formData in server side is always null! this is my script: Edit 1: This is the action method in controller: public

PHP fileUpload with Pdf/Docx Instead of Image

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an example code below working for images as user's input, <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } if (file_exists($target_file)) { echo "Sorry, file already exists.

Ajax FileUpload &amp; JQuery formData in ASP.NET MVC

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some problem with posting formData to server side action method. Because ajax call doesn't send files to server, I have to add file uploader data to formData manually like this: var formData = new FormData(); formData.append("imageFile", $("#imageFile").file); formData.append("coverFile", $("#coverFile").file); I wrote jQuery function that need to post form data to server using ajax call. It's works but posted formData in server side is always null! this is my script: Edit 1: This is the action method in controller: public