Upload File To Website

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Upload File To Website

Post by warrenk » Thu Mar 19, 2009 8:19 pm

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

Tim
Posts: 29
Joined: Wed Oct 31, 2007 12:56 pm

Post by Tim » Thu Mar 19, 2009 9:16 pm

Hi Warren,

try:

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

Best,

Tim.

warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Post by warrenk » Fri Mar 20, 2009 8:38 pm

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

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix » Wed Sep 30, 2009 4:52 pm

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 ?

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Post by trevix » Fri Oct 02, 2009 11:23 pm

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 ?

trevix
Posts: 1064
Joined: Sat Feb 24, 2007 11:25 pm
Contact:

Solved (locked folder)

Post by trevix » Sat Oct 03, 2009 2:11 pm

Thanks to another post I solved the problem.
Before deleting the folder(s), I set the "Defaultfolder" to a different folder...

Trevix

Post Reply