On Tue, 04 Mar 2008 16:26:03 -0000, "das_e_i" <[EMAIL PROTECTED]> wrote:

>I'm writing a script for uploading image files to a FTP-server.
>I use the windows ftp.exe to access the server, having it execute a 
>temporary command file which I create with Powerpro. However, I don't 
>seem to be able to open a file for writing (file doesn't exist, 
>should be created). If I manually create the file, it is opened but I 
>can't write to it, no error messages then, but no content either.
>Here's the relevant part of the script:
>
>Local handle=File.Open(strTempDir++"ftpcommands.txt", w)
>if(handle>0) do
>       Win.Debug("Successfully opened"++strTempDir+
>+"ftpcommands.txt")
>       File.WriteLine(handle,"open "++strHostname)
>       File.WriteLine(handle, strUser)
>       File.WriteLine(handle, strPassword)
>       File.WriteLine(handle,"binary")
>       File.WriteLine(handle,"send "++strFile)
>       File.WriteLine(handle,"close")
>       File.WriteLine(handle,"quit")

handle.close

>       do("ftp", "-s:ftpcommands.txt", strTempDir)
>else
>       Win.Debug("Can't open "++strTempDir++"ftpcommands.txt, handle 
>is" ++ handle)
>endif
>
>The path is printed correctly in debug window, value of handle when 
>file doesn't exist and I attempt to open it is -2.
>Any ideas?

You need to insert the line I added above. After writing to a file you have
to close it before it can be read.

Opening files without closing them can cause problems. Before continuing
your debugging, I suggest you reboot to make sure all the files are closed.
-- 
Carroll Robbins

Reply via email to