Can't find .pen file during syncronization from CsWeb

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Post Reply
Barcaman
Posts: 5
Joined: February 11th, 2015, 6:35 am

Can't find .pen file during syncronization from CsWeb

Post by Barcaman »

Hello guys
We can't solve this problem.
"Error downloading file ..../TEST4.pen": Check that the file exists on the server, that the path is correct and that you have permission to read the file."

but file is exist in server.

We check php setting, all is well.
fileinfo extension loaded
finfo_open exists
finfo_file exists
Testing finfo: text/x-php
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Can't find .pen file during syncronization from CsWeb

Post by josh »

make sure that the path on the server matches the path that you gave it. Paths on the server are relative to the files directory (csweb/files) so if you put your pen file in csweb/files/TEST4.pen then the path to use in the sync settings (or syncfile) is /TEST4.pen
Barcaman
Posts: 5
Joined: February 11th, 2015, 6:35 am

Re: Can't find .pen file during syncronization from CsWeb

Post by Barcaman »

josh wrote:make sure that the path on the server matches the path that you gave it. Paths on the server are relative to the files directory (csweb/files) so if you put your pen file in csweb/files/TEST4.pen then the path to use in the sync settings (or syncfile) is /TEST4.pen
Dear Josh.
We are trying to synchronize with syntax

Code: Select all

function syncWithHeadquarters()

	if syncconnect(CSWeb, "http://ip..../csweb/api") = 1 then

	syncfile(GET, "/TEST4/TEST4.pen",
		 "TEST4.pen");
	syncfile(GET, "/TEST4/TEST4.pff",
		"TEST4.pff");
			syncdisconnect();
	endif;
end;
Path on the server
"...\www\csweb\files\apps\TEST4.zip"
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Can't find .pen file during syncronization from CsWeb

Post by josh »

The paths do not match. syncfile(GET, "/TEST4/TEST4.pen") tells CSPro to look in the directory csweb/files/TEST4/ for the file named TEST4.pen. However on your server you have a file named TEST4.zip in the directory csweb/files/apps/. The two directories are not the same.

In addition, you are asking to download the individual pen and pff files but on the server you have only the zip file. You either need to place the individual pen and pff files unzipped on the server or use syncfile to download the zip file and then use the decompress function to extract the pen and pff files from the zip.

Alternatively, rather than do you sync form logic just have the interviewer use add application from the menu to download the latest version of the application. If you are have the application installed, it will update it to the latest version from the server.
Barcaman
Posts: 5
Joined: February 11th, 2015, 6:35 am

Re: Can't find .pen file during syncronization from CsWeb

Post by Barcaman »

Hi Josh.
We used function decompress, but we can't decompress .zip file in server folder (/files/Apps/TEST4/).
I looked at this example but it works only in certain folders (Application,Documents,Desktop,ProgramFiles,Windows).
Can you explain how the decompress function works and how to specify the /files/apps/TEST4.zip folder in pathname.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Can't find .pen file during syncronization from CsWeb

Post by josh »

Like I said you have two options:

1) Unzip the file on the server. For this do not use decompress function. Do not use CSPro at all. Just use Windows to unzip the file and copy the pen and pff files onto the server. then you can use multiple calls to syncfile to download each of the individual files.

2) Decompress the zip file after you download it using syncfile. This will not be on the server but on the client machine. I would download the zip file the temp directory and then decompress it to the directory that your application is in using the decompress function. I have attached an example program that does this. This is the sync from logic example from the CSPro examples folder modified to download and decompress the deployed zip file from the server. The relevant code is in the function syncWithHeadquarters():
        // Download latest application files from the server.

        // Deploy tool puts a zip file in the apps directory on the server
        string serverZipPath = "/apps/Synchronization in Logic.zip";

        // We will save the zip file in the temp folder on the local device
        string localZipPath = pathname(temp) + "Synchronization in Logic.zip";

        // Path to current application directory. Since we are currently in the
        // menu program, pathname(Application) will give us the menu directory
        // so we add ".." to the end to go up one level to the "Synchronization in Logic"
        // directory.
        string localApplicationPath = pathname(Application) + "../";

        // Download the zip file
        syncfile(GET, serverZipPath, localZipPath);

        // Unzip the file to local application directory
        decompress(localZipPath, localApplicationPath);

        // Delete the zip file
        filedelete(localZipPath);
Attachments
UpdateAppFromZip.zip
(16.35 KiB) Downloaded 247 times
Post Reply