Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to upload files in webserver through visual foxpro c
Message
 
À
07/10/2011 08:11:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01525844
Message ID:
01525886
Vues:
98
There are a number of ways to upload files to a server. Typically you upload files via FTP if you're doing a generic file upload and when an FTP server is available to do so. If you're sending up only files without related information this is the easiest way to get data to the server. FTP is just a file transfer format - there's no logic there just a transfer. There are many libraries out there to do this including our West Wind Client Tools. Here's an example with the latter:
o=create("wwFTP")

o.FTPConnect("ftp.west-wind.com")
o.FTPSendFileEx("/downloads/pkzip.exe","c:\temp\pkzip.exe")
o.FTPSendFileEx("/downloads/pkunzip.exe","c:\temp\pkunzip.exe")
o.FTPClose()
If you need more control over the upload and you need to send additional information along with the upload and need immediate confirmation then typically you can use Web based HTTP uploads. This is the type of thing that Facebook or YouTube or any content provider uses to get data to the server. This requires that the Web Server has some endpoint Url that can accept your files. IOW, something on the server runs some code to accept your files at a URL. The upside to HTTP uploads is that the server has more control over when files are uploaded and you can capture additional information about the upload at the same time of the upload. The server can also provide more information and post processing of the uploaded data.
Http Uploads are common with various services, but as I mentioned if the server doesn't have an HTTP endpoint to receive the files then this is not an option.

To do this with wwHttp (from the Client Tools) it looks like this:
oHTTP = CREATEOBJECT("wwHTTP")

*** Set mode to multi-part form
oHTTP.nHttpPostMode = 2

*** Post a file and a regular form variable
oHttp.AddPostKey("File","d:\temp\wws_invoice.pdf",.T.)
oHttp.AddPostKey("txtFileNotes","test note")

lcHTML = oHTTP.HTTPGet("http://localhost/wconnect/FileUpload.wwd")

*** Display result from server
ShowHTML(lcHTML)
Hope this helps,

+++ Rick ---


>Hi,
>Experts, could any one help me that how to upload some files in web server using visual foxpro commands ?
>i.e. - I want to place some html files in my web space (which I have already booked) using visual foxpro commands or through some visual foxpro application, is it possible ? please give me some suggessions !
>
>Umasankar Panda
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform