L'écriture de fichier fonctionne ! Reste à définir un rép par défaut !
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
<property name="maxUploadSize" value="100000" />
|
<property name="maxUploadSize" value="10000000" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package org.yacos.web.author.controller;
|
package org.yacos.web.author.controller;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@@ -23,7 +29,7 @@ public class SArticleController extends SimpleFormController {
|
|||||||
private IArticleManager articleManager;
|
private IArticleManager articleManager;
|
||||||
|
|
||||||
public ModelAndView onSubmit(Object command)
|
public ModelAndView onSubmit(Object command)
|
||||||
throws ServletException {
|
throws ServletException, IllegalStateException, IOException {
|
||||||
|
|
||||||
String title = ((FormSubmission) command).getTitle();
|
String title = ((FormSubmission) command).getTitle();
|
||||||
String theme = ((FormSubmission) command).getTheme();
|
String theme = ((FormSubmission) command).getTheme();
|
||||||
@@ -35,13 +41,21 @@ public class SArticleController extends SimpleFormController {
|
|||||||
|
|
||||||
System.out.println(liste);
|
System.out.println(liste);
|
||||||
|
|
||||||
|
|
||||||
// let's see if there's content there
|
// let's see if there's content there
|
||||||
MultipartFile file = ((FormSubmission) command).getFile();
|
MultipartFile file = ((FormSubmission) command).getFile();
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
// hmm, that's strange, the user did not upload anything
|
// hmm, that's strange, the user did not upload anything
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte b[] = file.getBytes();
|
||||||
|
File file2 = new File(file.getOriginalFilename());
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(file2);
|
||||||
|
|
||||||
|
fos.write(b);
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
|
||||||
Article a = new Article(0, title, theme, "", mainauthor, null, 1);
|
Article a = new Article(0, title, theme, "", mainauthor, null, 1);
|
||||||
articleManager.addArticle(a);
|
articleManager.addArticle(a);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user