wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashindler <alexshind...@hotmail.com>
Subject Fileupload causes internet explorer 11 to hang
Date Tue, 15 Jul 2014 14:37:09 GMT
Hi,

I have the following code - with google chrome I experience no problems but
in internet explorer 11 the page hangs and gets stuck. I am using the latest
version of wicket. 

Any ideas?

Code summary:

                Form uploadForm = new Form("uploadForm");		
		uploadForm.setMultiPart(true);
		uploadForm.setMaxSize(Bytes.kilobytes(100));
		uploadForm.add(fileUpload = new FileUploadField("fileUpload"));
		
		uploadForm.add(new AjaxButton("upload", uploadForm){

			@Override
			public void onSubmit(AjaxRequestTarget target, Form uploadForm) {
				
				
				final FileUpload uploadedFile = fileUpload.getFileUpload();
				if (uploadedFile != null) {
	 
					// write to a new file
					File newFile = new File(UPLOAD_FOLDER
						+ uploadedFile.getClientFileName());
	 
					if (newFile.exists()) {
						newFile.delete();
					}
	 
					try {
						newFile.createNewFile();
						uploadedFile.writeTo(newFile);
	 
					} 
					catch (Exception e) {throw new IllegalStateException("Error");}
				}
				
				
				//Upload file to folder in my application
				String dataFileName = ((WebApplication)
Application.get()).getServletContext().getRealPath("/")+"WEB-INF\\classes\\ums\\app\\TransitMemshak\\memshak.txt";
				
				//Check if there is a file for upload
				File myFile = new File(dataFileName);
				if(!myFile.exists()){				
					informationDialog.setMessage("There is no file to upload!");
					informationDialog.show(target);
				}
				
				BufferedReader bReader;
				try {
					
					bReader = new BufferedReader(new FileReader(dataFileName));
				
					String line;
					while ((line = bReader.readLine()) != null) {
						
						//upload file code and logic	etc here
					}
					
					bReader.close();
					
					//Delete file
					if(myFile.exists())
					    myFile.delete();
									
				} 
				
				catch (FileNotFoundException e) {e.printStackTrace();}
				catch (IOException e) {e.printStackTrace();}
				catch (ClassNotFoundException e) {e.printStackTrace();}
				catch (SQLException e) {e.printStackTrace();}
				
			}
			@Override
			protected void onError(AjaxRequestTarget target, Form uploadForm) {
				errorDialog.setErrors(CommonTasks.errorDisplay(target, uploadForm));
				errorDialog.show(target);
			}
			
		});

		add(uploadForm);

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Fileupload-causes-internet-explorer-11-to-hang-tp4666619.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message