Page 1 of 1

Upload File To Website

Posted: Thu Mar 19, 2009 8:19 pm
by warrenk
For some reason, I cannot upload a file using the libURLftpUploadFile. I keep getting errors connecting to my website. Can I upload a file using something similar to the command:

put "work.db" into url "ftp://user:password@ftp.website.com/work.db"

When I try the above command, I get a file on my website called work.db (which is correct...so I am able to connect), but the contents of the file are "work.db". I want to upload a file called work.db.

Anyway to modify the above command to upload a file?

Thanks,
Warren

Posted: Thu Mar 19, 2009 9:16 pm
by Tim
Hi Warren,

try:

put url "file:work.db" into url "ftp://user:password@ftp.website.com/work.db"

Best,

Tim.

Posted: Fri Mar 20, 2009 8:38 pm
by warrenk
Tim,

Thanks for the help. This worked. I found my problem was my file.db was locked when I am trying to upload it. I got around this by copying it to a another file before uploading at it works great.

Thanks again!

Warren

Posted: Wed Sep 30, 2009 4:52 pm
by trevix
Great place for solutions...hope this gets trought too...
On Windows XP, I upload several files and folder to a web server (the Host of my web pages, RedLinux).
My function script:

Code: Select all

function SendToWeb userName userPassword PathFrom PathDestination --this is called from a loop that mymics a local folder with a folder on the web host
   set the defaultfolder to PathFrom
   put the files into ListaFiles --this list all the files on the local folder
   set the itemdelimiter to "."
   repeat for each line TheFile in ListaFiles
      if last item of TheFile = "html" or last item of TheFile = "png" or last item of TheFile = "css" or last item of TheFile = "js" then --just the valid files (no OSX stuff)
         if the visible of stack "attesa" is false then --stack "attesa" keep the user informed on the transfer
            return empty
         end if
         if last item of TheFile = "html" then --I tough I should distinguish...
            put "file:"  into Prefisso
         else
            put "binfile:"  into Prefisso
         end if
         put Prefisso & PathFrom & "/" & TheFile into PathFromWhere
         libURLSetStatusCallback "myProgress",the long ID of scrollbar "ScrollbarTC" of stack "attesa" 
         put "ftp://" & URLEncode(userName) & ":" & URLEncode(userPassword) & "@" & PathDestination  & "/" & TheFile   into PathDestinationWhere
         put url PathFromWhere into url PathDestinationWhere
         put the result into errore
         if errore is not empty then
            return errore
         end if
      end if
   end repeat
end SendToWeb
Everything works fine except that after the script has ended and everything has been upload and the web page is fine, the local folder gets locked (...file in use) and I cannot delete it (must close Revolution).
I tried a ResetAll (but I need to keep other sockets open...), I tried to wait some more but no result.
Can someone help me ?

Posted: Fri Oct 02, 2009 11:23 pm
by trevix
Updates:
I tried with libURLftpUploadFile, with Vista, cleaning the opensockets after the upload.
I noticed that all the files can be deleted but the folders and subfolders get locked up until i quit revolution (or the generated standalone...)

Any help ?

Solved (locked folder)

Posted: Sat Oct 03, 2009 2:11 pm
by trevix
Thanks to another post I solved the problem.
Before deleting the folder(s), I set the "Defaultfolder" to a different folder...

Trevix