|
-
Apr 23rd, 2010, 02:54 PM
#1
Thread Starter
Lively Member
[RESOLVED] Looking for a way to send/upload text
I am in need of some ideas on how to approach sending/uploading a peice of text(lets say like a username or something of that sort) to a place that i can view the peice of text with ease.
I'm not sure what the best way to approach this would be.
-
Apr 23rd, 2010, 03:43 PM
#2
Re: Looking for a way to send/upload text
You about an ASP script (simple) that will take the parameter passed and store it in an online DB? Then simply use Inet or whatever and hit that URL passing the text as a parameter ( www.google.com/script.asp?user=[whatever])
-
Apr 23rd, 2010, 04:16 PM
#3
Thread Starter
Lively Member
Re: Looking for a way to send/upload text
That sounds exactly like what i need.
The Inet part is no problem. But how would i go about creating the ASP script(i have no knowledge on that). Is there an example that i can view that functions the way i need it to?
ty
-
Apr 23rd, 2010, 04:21 PM
#4
Re: Looking for a way to send/upload text
ASP works with VBScript (by default, but it can be JavaScript too), so adapting to it will be a breeze. For example:
Code:
Dim strUsername
strUsername = Request.QueryString("user")
That will get you the string the user passed in the parameter called "user".
But since you are storing this you should also make a function for data sanitizing (to protect against SQL injection attacks and such).
When you sanitize the data received, establish a connection with the DB (depends on DB type) then you can use standard SQL statements (INSERT INTO) to store it in the DB.
-
Apr 23rd, 2010, 05:47 PM
#5
Re: Looking for a way to send/upload text
For something simple you don't even need to do that.
You can get free or cheap WebDAV hosting. This usually comes with a Web based "console" you can use to manage it and pull files off with.
Your program can be a WebDAV client and create and write files on the server, or append to existing files, read files, etc. No need for a database and no need to write any server-side logic at all. You can even map a drive letter to a WebDAV share in WinXP or later with no added software.
MyDrive offers a basic 2GB account for free. There are others out there too.
The ASP/PHP/CGI approach will work but it's more to do, more to support, etc. if your need is just remote storage.
There is no standard VB6 WebDAV client component but prior to Windows Vista you can use ADO objects since they can do it. Or you can write a little code to wrap around WinInet, XMLHTTPRequest, or WinHTTPRequest. Applying a little google will probably find you a number of 3rd party WebDAV client components too, though I don't know of a free one.
-
Apr 24th, 2010, 11:56 AM
#6
Thread Starter
Lively Member
Re: Looking for a way to send/upload text
So i've been playing around with the code posted below, but it isn't working out. I don't get any error message, but the file doesn't get uploaded to mydrive storage site. o_O
Code:
Private Sub cmdTest_Click()
WebUploadFile "C:\test.txt", "http://webdav.mydrive.ch", "Uname", "Pword"
End Sub
Function WebUploadFile(file, url, user, pass)
Dim objXMLHTTP
Dim objADOStream
Dim arrbuffer
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1
objADOStream.LoadFromFile file
arrbuffer = objADOStream.Read()
Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "PUT", url, False, user, pass
objXMLHTTP.send arrbuffer
objADOStream.flush
objADOStream.close
End Function
Any ideas? ty!
-
Apr 24th, 2010, 11:50 PM
#7
-
Apr 24th, 2010, 11:53 PM
#8
Thread Starter
Lively Member
Re: Looking for a way to send/upload text
Hey thank you very much for your help! I've been playing around with my code a bit more today and finally got it working the way i want!
Also thank you for posting your demo, it can help me understand the process a lot better!!! =)
-
Apr 24th, 2010, 11:57 PM
#9
Re: [RESOLVED] Looking for a way to send/upload text
Check it out though. If you upload using a plain PUT the server has to make a lot of assumptions about what you want it to do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|