add FTP address check before upload
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Tue Dec 17 09:22:55 WIB 2024
|
||||
#Tue Dec 17 09:43:51 WIB 2024
|
||||
AudioPhase1=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase1.mp3
|
||||
AudioPhase2=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase2.mp3
|
||||
AudioPhase3=C\:\\Users\\rdkar\\OneDrive\\Documents\\IntelliJ Project\\ErhaCam\\audio\\phase3.mp3
|
||||
|
||||
BIN
database.db
BIN
database.db
Binary file not shown.
@@ -1,7 +1,8 @@
|
||||
package FTP;
|
||||
|
||||
import lombok.val;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.io.CopyStreamEvent;
|
||||
import org.apache.commons.net.io.CopyStreamListener;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -73,9 +74,19 @@ public class FTPUpload {
|
||||
File localFile = new File(file);
|
||||
if (localFile.exists()) {
|
||||
FileInputStream input = new FileInputStream(localFile);
|
||||
ProgressInputStream pis = new ProgressInputStream(file, input, localFile.length(), event);
|
||||
//ProgressInputStream pis = new ProgressInputStream(file, input, localFile.length(), event);
|
||||
if (event!=null) event.onUploadStarted(file);
|
||||
ftp.storeFile(localFile.getName(), pis);
|
||||
ftp.setCopyStreamListener(new CopyStreamListener() {
|
||||
@Override
|
||||
public void bytesTransferred(CopyStreamEvent copyStreamEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, long streamSize) {
|
||||
if (event!=null) event.onUploadProgress(file, totalBytesTransferred, streamSize);
|
||||
}
|
||||
});
|
||||
ftp.storeFile(localFile.getName(), input);
|
||||
input.close();
|
||||
if (event!=null) event.onUploadSuccess(file);
|
||||
success++;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane prefHeight="280.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.co.gtc.erhacam.Cameradetail">
|
||||
<AnchorPane prefHeight="280.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="id.co.gtc.erhacam.Cameradetail">
|
||||
<children>
|
||||
<GridPane layoutX="5.0" layoutY="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
@@ -45,8 +45,8 @@
|
||||
<children>
|
||||
<GridPane layoutX="-28.0" layoutY="-29.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="70.0" prefWidth="100.0" />
|
||||
<ColumnConstraints fillWidth="false" maxWidth="-Infinity" minWidth="-Infinity" percentWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||
<ColumnConstraints fillWidth="false" minWidth="10.0" percentWidth="20.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
@@ -103,12 +103,15 @@
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="streamanchor">
|
||||
<children>
|
||||
<HBox alignment="CENTER" prefHeight="240.0" prefWidth="700.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<ImageView fx:id="camerastream" fitHeight="240.0" pickOnBounds="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<image>
|
||||
<Image url="@gtcbackground.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<StackPane prefHeight="240.0" prefWidth="351.2" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<ImageView fx:id="camerastream" fitHeight="240.0" pickOnBounds="true">
|
||||
<image>
|
||||
<Image url="@gtcbackground.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</children>
|
||||
</StackPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
|
||||
Reference in New Issue
Block a user