diff --git a/Love_Live!_Logo.png b/Love_Live!_Logo.png index 4cd1d5c..a7704e2 100644 Binary files a/Love_Live!_Logo.png and b/Love_Live!_Logo.png differ diff --git a/out/DIRECTORY_LISTING b/out/DIRECTORY_LISTING index 7ccc9a1..24a95e1 100644 --- a/out/DIRECTORY_LISTING +++ b/out/DIRECTORY_LISTING @@ -30,7 +30,15 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Directory Listing for /

📁.. (Previous Directory)
+

Directory Listing for /

📁.. (Previous Directory)
📁articles 2022-05-19T19:07:02.131093Z gitpod 190
+
🗎codeBackground 2022-05-19T19:07:02.067093Z gitpod 2635
+
🗎otherpage.html 2022-05-19T19:07:02.103093Z gitpod 9684
+
🗎reset.css 2022-05-19T19:07:02.075093Z gitpod 1093
+
🗎sig.css 2022-05-19T19:07:02.083093Z gitpod 5175
+
🗎testfile.html 2022-05-19T19:07:02.107093Z gitpod 1621
+
🗎uploadform.html 2022-05-19T19:07:02.107093Z gitpod 1676
+
📁uploads 2022-05-19T14:49:27Z gitpod 6
+
diff --git a/out/articles/DIRECTORY_LISTING b/out/articles/DIRECTORY_LISTING index 08018c2..0c67efc 100644 --- a/out/articles/DIRECTORY_LISTING +++ b/out/articles/DIRECTORY_LISTING @@ -30,11 +30,11 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Directory Listing for \articles\

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-19T03:42:49.8911626Z LAPTOP-NEAKT518\sigon (User) 582
-
🗎curabitur vel tempus ex.article.html 2022-05-19T03:42:49.9478986Z LAPTOP-NEAKT518\sigon (User) 2088
-
🗎sigplace1.article 2022-05-19T03:42:49.8946864Z LAPTOP-NEAKT518\sigon (User) 3821
-
🗎sigplace1.article.html 2022-05-19T03:42:49.9512871Z LAPTOP-NEAKT518\sigon (User) 5316
-
📁test articles 2022-05-19T03:42:49.9718854Z LAPTOP-NEAKT518\sigon (User) 4096
+

Directory Listing for /articles/

📁.. (Previous Directory)
🗎curabitur vel tempus ex.article 2022-05-19T19:07:02.055093Z gitpod 579
+
🗎sigplace1.article 2022-05-19T19:07:02.059093Z gitpod 3807
+
📁test articles 2022-05-19T19:07:02.123093Z gitpod 147
+
🗎curabitur vel tempus ex.article.html 2022-05-19T19:07:02.111093Z gitpod 2088
+
🗎sigplace1.article.html 2022-05-19T19:07:02.115093Z gitpod 5316
diff --git a/out/articles/curabitur vel tempus ex.article b/out/articles/curabitur vel tempus ex.article index 0299e0b..0db425c 100644 --- a/out/articles/curabitur vel tempus ex.article +++ b/out/articles/curabitur vel tempus ex.article @@ -1,3 +1,3 @@ -

Curabitur vel tempus ex

+

Curabitur vel tempus ex

Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.

29 Apr 2022 7:37PM
%CONDITIONAL_EXPAND%
diff --git a/out/articles/curabitur vel tempus ex.article.html b/out/articles/curabitur vel tempus ex.article.html index 864a1bc..1c43685 100644 --- a/out/articles/curabitur vel tempus ex.article.html +++ b/out/articles/curabitur vel tempus ex.article.html @@ -30,7 +30,7 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Curabitur vel tempus ex

+

Curabitur vel tempus ex

Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.

29 Apr 2022 7:37PM
diff --git a/out/articles/sigplace1.article b/out/articles/sigplace1.article index 344fa39..0de275c 100644 --- a/out/articles/sigplace1.article +++ b/out/articles/sigplace1.article @@ -1,4 +1,4 @@ -

Welcome to SigPlace!

+

Welcome to SigPlace!

This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.

Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.

A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.

diff --git a/out/articles/sigplace1.article.html b/out/articles/sigplace1.article.html index 4090968..7cfea45 100644 --- a/out/articles/sigplace1.article.html +++ b/out/articles/sigplace1.article.html @@ -30,7 +30,7 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Welcome to SigPlace!

+

Welcome to SigPlace!

This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.

Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.

A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.

diff --git a/out/articles/test articles/DIRECTORY_LISTING b/out/articles/test articles/DIRECTORY_LISTING index 54a6134..95ee328 100644 --- a/out/articles/test articles/DIRECTORY_LISTING +++ b/out/articles/test articles/DIRECTORY_LISTING @@ -30,12 +30,12 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Directory Listing for \articles\test articles\

🗎test1.article 2022-05-19T03:42:49.8963007Z LAPTOP-NEAKT518\sigon (User) 1071
-
🗎test1.article.html 2022-05-19T03:42:49.9539501Z LAPTOP-NEAKT518\sigon (User) 2577
-
🗎test2.article 2022-05-19T03:42:49.8982941Z LAPTOP-NEAKT518\sigon (User) 767
-
🗎test2.article.html 2022-05-19T03:42:49.957395Z LAPTOP-NEAKT518\sigon (User) 2273
-
🗎test3.article 2022-05-19T03:42:49.8999694Z LAPTOP-NEAKT518\sigon (User) 980
-
🗎test3.article.html 2022-05-19T03:42:49.959957Z LAPTOP-NEAKT518\sigon (User) 2486
+

Directory Listing for /articles/test articles/

🗎test1.article 2022-05-19T19:07:02.059093Z gitpod 1068
+
🗎test2.article 2022-05-19T19:07:02.059093Z gitpod 764
+
🗎test3.article 2022-05-19T19:07:02.063093Z gitpod 977
+
🗎test1.article.html 2022-05-19T19:07:02.115093Z gitpod 2577
+
🗎test2.article.html 2022-05-19T19:07:02.119093Z gitpod 2273
+
🗎test3.article.html 2022-05-19T19:07:02.123093Z gitpod 2486
diff --git a/out/articles/test articles/test1.article b/out/articles/test articles/test1.article index 4fe01b9..9524026 100644 --- a/out/articles/test articles/test1.article +++ b/out/articles/test articles/test1.article @@ -1,3 +1,3 @@ -

A Test Title

+

A Test Title

In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.

2 May 2022 10:16AM
%CONDITIONAL_EXPAND%
diff --git a/out/articles/test articles/test1.article.html b/out/articles/test articles/test1.article.html index 7a84137..534d2ee 100644 --- a/out/articles/test articles/test1.article.html +++ b/out/articles/test articles/test1.article.html @@ -30,7 +30,7 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

A Test Title

+

A Test Title

In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.

2 May 2022 10:16AM
diff --git a/out/articles/test articles/test2.article b/out/articles/test articles/test2.article index 955584d..2226e09 100644 --- a/out/articles/test articles/test2.article +++ b/out/articles/test articles/test2.article @@ -1,3 +1,3 @@ -

Another test title

+

Another test title

Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.

1 May 2022 05:13AM
%CONDITIONAL_EXPAND%
diff --git a/out/articles/test articles/test2.article.html b/out/articles/test articles/test2.article.html index d4472b9..fffcf5f 100644 --- a/out/articles/test articles/test2.article.html +++ b/out/articles/test articles/test2.article.html @@ -30,7 +30,7 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

Another test title

+

Another test title

Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.

1 May 2022 05:13AM
diff --git a/out/articles/test articles/test3.article b/out/articles/test articles/test3.article index 57837b0..6fc6364 100644 --- a/out/articles/test articles/test3.article +++ b/out/articles/test articles/test3.article @@ -1,3 +1,3 @@ -

And More

+

And More

Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.

30 Apr 2022 6:14PM
%CONDITIONAL_EXPAND%
diff --git a/out/articles/test articles/test3.article.html b/out/articles/test articles/test3.article.html index 5105bc7..438ad8c 100644 --- a/out/articles/test articles/test3.article.html +++ b/out/articles/test articles/test3.article.html @@ -30,7 +30,7 @@ bunch of random Java code. System.err.println(Failed to build directory listings!"); return; } -

And More

+

And More

Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.

30 Apr 2022 6:14PM
diff --git a/out/codeBackground b/out/codeBackground index c3db2d1..8b8a175 100644 --- a/out/codeBackground +++ b/out/codeBackground @@ -4,13 +4,14 @@ while (true) { try (Socket client = socket.accept()) { System.out.println("New client connection detected: "+client.toString()); - BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream(),"ISO-8859-1")); String requestLine,line; ZonedDateTime modifiedDate = null; String boundary=null; - boolean uploadData = false; boolean truncateUntilBoundary=false; String filename=null; + OutputStream stream = null; + boolean firstLine=true; requestLine=in.readLine(); //Read the first line, this should be our request. if (requestLine!=null) { String[] splitter = requestLine.split(Pattern.quote(" ")); @@ -18,7 +19,6 @@ if (splitter.length==3) { while (in.ready()) { line=in.readLine(); - if (ISPOST) { if (boundary!=null) { if (!truncateUntilBoundary) { @@ -29,12 +29,12 @@ truncateUntilBoundary=true; } } - } else - if (line.contains(boundary)) { - System.out.println(""); - System.out.println("<...>"); - System.out.println(""); - System.out.println(line); - truncateUntilBoundary=false; - - + } else + if (line.contains("Content-Disposition: ")||line.contains("Content-Type: ")) { + if (line.contains("filename=")) { + filename=line.substring(line.indexOf("filename=")+"filename=".length()+1); + filename = filename.substring(0,filename.length()-1); + } else { + System.out.println(line); + } + } else { diff --git a/out/otherpage.html b/out/otherpage.html index 0493d57..1aaf8e2 100644 --- a/out/otherpage.html +++ b/out/otherpage.html @@ -39,7 +39,7 @@ This is a different webpage.
modify.remove(); } -

Welcome to SigPlace!

+

Welcome to SigPlace!

This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.

Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.

A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.

@@ -52,19 +52,19 @@ This is a different webpage.

Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.


Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.

-
3 May 2022 10:25AM




⤈ Click to expand.
-

A Test Title

+
3 May 2022 10:25AM




⤈ Click to expand.
+

A Test Title

In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.

-
2 May 2022 10:16AM




⤈ Click to expand.
-

Another test title

+
2 May 2022 10:16AM




⤈ Click to expand.
+

Another test title

Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.

-
1 May 2022 05:13AM




⤈ Click to expand.
-

And More

+
1 May 2022 05:13AM




⤈ Click to expand.
+

And More

Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.

-
30 Apr 2022 6:14PM




⤈ Click to expand.
-

Curabitur vel tempus ex

+
30 Apr 2022 6:14PM




⤈ Click to expand.
+

Curabitur vel tempus ex

Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.

-
29 Apr 2022 7:37PM




⤈ Click to expand.
+
29 Apr 2022 7:37PM




⤈ Click to expand.
diff --git a/out/uploads/Love_Live!_Logo.png b/out/uploads/Love_Live!_Logo.png new file mode 100644 index 0000000..2f52540 Binary files /dev/null and b/out/uploads/Love_Live!_Logo.png differ diff --git a/out/uploads/Untitled.png b/out/uploads/Untitled.png deleted file mode 100644 index ad8a254..0000000 Binary files a/out/uploads/Untitled.png and /dev/null differ diff --git a/sigServer.java b/sigServer.java index 5800e6d..97ac328 100644 --- a/sigServer.java +++ b/sigServer.java @@ -9,6 +9,7 @@ import java.net.Socket; import java.net.SocketException; import java.net.URLDecoder; import java.nio.ByteBuffer; +import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.charset.UnmappableCharacterException; @@ -37,13 +38,14 @@ public class sigServer { while (true) { try (Socket client = socket.accept()) { System.out.println("New client connection detected: "+client.toString()); - BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream(),"ISO-8859-1")); String requestLine,line; ZonedDateTime modifiedDate = null; String boundary=null; - boolean uploadData = false; boolean truncateUntilBoundary=false; String filename=null; + OutputStream stream = null; + boolean firstLine=true; requestLine=in.readLine(); //Read the first line, this should be our request. if (requestLine!=null) { String[] splitter = requestLine.split(Pattern.quote(" ")); @@ -61,17 +63,6 @@ public class sigServer { truncateUntilBoundary=true; } } - } else - if (line.contains(boundary)) { - System.out.println(""); - System.out.println("<...>"); - System.out.println(""); - System.out.println(line); - truncateUntilBoundary=false; - - filename=null; - uploadData=false; - System.out.println("Saving upload to "+sigPlace.UPLOADSDIR+" directory."); } else if (line.contains("Content-Disposition: ")||line.contains("Content-Type: ")) { if (line.contains("filename=")) { @@ -81,17 +72,36 @@ public class sigServer { System.out.println(line); } } else { - OutputStream stream = null; - byte[] byteContent = new String(line.getBytes(),StandardCharsets.UTF_8).getBytes(StandardCharsets.UTF_8); File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename); // check if file exist, otherwise create the file before writing if (!myFile.exists()) { myFile.createNewFile(); + } else { + myFile.delete(); + myFile.createNewFile(); } stream = new FileOutputStream(myFile); - stream.write(byteContent); - stream.flush(); + char[] buffer = new char[1024]; + int count; + while ((count = in.read(buffer))>0) { + //stream.write(in.read(buffer)); + //stream.write(buffer.,0,count); + String buf = new String(buffer); + byte[] data = buf.getBytes("ISO-8859-1"); + stream.write(data,0,count); + if (buf.contains(boundary)) { + System.out.println(""); + System.out.println("<...>"); + System.out.println(""); + System.out.println(new String(data,StandardCharsets.UTF_8)); + break; + } + } stream.close(); + + filename=null; + firstLine=true; + System.out.println("Saving upload to "+sigPlace.UPLOADSDIR+" directory."); } } if (line.contains("Content-Type: multipart/form-data; boundary=")) { diff --git a/snippet b/snippet new file mode 100644 index 0000000..df0d24e --- /dev/null +++ b/snippet @@ -0,0 +1 @@ +!�BH` !�BH` !�BH` !�B ,!�B ,!�B ,!�B!�%�BQ �o \ No newline at end of file