Safety system. Android FTP WebCam Rescue Photo - Android Phone Web Cam with FTP support

Android Photo Software

Android FTP Upload


      Android Source Code
      
      Java program for surveillance using an Android smartphone. Webcam with FTP access to the photo storage.
      
      Uploading a file to an FTP server
      
      There are several peculiarities here. The file must be downloaded not to the folder that will be the root after connecting, but to the one that the web browser uses when viewing the file index.htm
      
      public boolean ftpUpload(String srcFilePath, String desFileName, String desDirectory, Context context, Integer ipnumber) {
        boolean status = false;
        try {
          //=======================================================
          // Before uploading the file, you need to go to the desired
          // directory on the FTP serverталог на FTP сервере
          //=======================================================
          mFTPClient.changeWorkingDirectory(desDirectory); //the name of the directory is passed from MainActivity.java
          // Upload file to FTP server
          FileInputStream srcFileStream = new FileInputStream(srcFilePath);
          //==========================================
          //GENERATE picture file name with number
          //==========================================
          if (nnum >= ipnumber+1) //Received ipnumber from SETUP - the number of pictures per session
          {
            nnum = 0; //Start image numbering again
          }
          nnum = nnum + 1;
          GenFileName = "eoflameron"+ nnum + ".jpg"; //GENERATE picture file name with number
          status = mFTPClient.storeFile(GenFileName, srcFileStream);
          
          srcFileStream.close();
          Log.d(TAG, "== == Upload to serever Ok == ==");
          return status;
          } catch (Exception e) {
            e.printStackTrace();
            Log.d(TAG, "== == Upload failed == ==: " + e);
          }
          return status;
        }
      }
      
      The Rescue PHOTO application uploads the specified number of images to the webserver. Image file names must be specified in the application.
      The following lines of source code create a filename from the pattern "eoflameron", a number, and the standard graphics filename extension ".jpg".
      
      nnum = nnum + 1;
      GenFileName = "eoflameron"+ nnum + ".jpg"; //GENERATE picture file name with number
      status = mFTPClient.storeFile(GenFileName, srcFileStream);
      
      Files with names will be created:
      
      eoflameron1.jpg
      eoflameron2.jpg
      eoflameron3.jpg
      ...etc.
      
      When your webcam uploads photos to your webserver, you yourself limit the number of photos per day. This is due to the volume of mobile Internet traffic and data transfer rates.
      The variable nnum shows the number of photo file names that will be generated.
      
      Upload file to FTP server
      
      ileInputStream srcFileStream = new FileInputStream(srcFilePath);
      
      Usually on FTP web hosting, access is performed in the wrong folder, which is the root for the website. If you do nothing, you will not be able to view the photos in your browser.
      When you register a paid or free web hosting, you will be given FTP access and given the server IP address, login and password. You need to use any FTP client and connect to your server via FTP. You will see something like the following picture (it differs from host to host. We will write what the differences may be).
      
      Android Source Code
      
      Here, by default, the content is shown where the FTP client is connected. You can see the public_html folder. It is in this folder that you need to upload photos.
      How can I check this? Go to this folder
      
      Android Source Code
      
      You can see that there is a file index in this folder. Go to your webserver with any browser and you will see the contents of the file index. The full file name is either index.htm, index.html, or index.php.
      Instead of this web page, we will host a web page for viewing photos.
      And now we need to change the current folder to public_html in the application (in this example).
      
      mFTPClient.changeWorkingDirectory(desDirectory);
      
      Here desDirectory is a variable that contains the name (string) of the folder (example public_html) to which you need to go before uploading a photo
      You can skip changing the folder and save photos to the folder where the FTP client connects. But then you need to create a PHP script that will extract images and place them on a web page for viewing. If you know how to program in PHP, this is relatively easy to do.
      
      
      
  Android Safety SYSTEM >>  
      
      You can use the web page with HTML and Java Script code. Such a web page can be hosted on any hosting. Or use the PHP web page and get more information. But then your free or paid hosting must support PHP.
      
      
Android Source Code >>
      
      The application has complex Java code. The source code spans several pages. Source codes of application modules are available on GitHub.


      
OFLAMERON.COM >>
      
      Android 10 Supported
Объясним всё
      

Android FTP Upload

Android phones safety system - Rescue PHOTO version 0.00 (technical release). (c) by Valery V Shmeleff
Android Safety System