Uploading A File To A Ftp Site????
Hi!
Is there any way to connect to a ftp site and login and after that upload a file from my local disc to the ftp site???
Some useful code would be great.....
/Smirre
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Connecting To An Ftp Site And Uploading
hi all, i got my ftp details, and all i basicly want to do is upload an image every 2 mins, overwriting the current one, how is this easily done? i could search the forums but most stuff is too much for what i want
Reading Excel File Using Vb6 And Uploading The File In The Database
good afternoon,
im creating a project that requires an excel file to be
read in VB6 and uploading it to the database.
i have successfully done the reading of excel in VB using fso but now,
the problem is i don't know how to upload this file in the database
and to make a checkpoint whether the data in the file is already in the database.
i've been trying so hard on this project for weeks but
can't get the answers.
please help me with my codes.
thank you so much in advance for your prompt help
btw, here's the code for reading the excel file
Dim cnncomp As ADODB.Connection
Dim rstcomp As ADODB.Recordset
Dim fso As Scripting.FileSystemObject
Dim lngrow As Long
Dim lngColumn As Long
Set fso = New Scripting.FileSystemObject
If (fso.FileExists(App.Path & "PcompList.UDL") = False) Then
MsgBox "ERROR: DSN / UDL file does not exist"
GoTo CLEAN_UP
End If
If (fso.FileExists(App.Path & "PcompList.xls") = False) Then
MsgBox "ERROR: Database file does not exist"
GoTo CLEAN_UP
End If
Set cnncomp = New ADODB.Connection
Set rstcomp = New ADODB.Recordset
cnncomp.Open "File Name=" & App.Path & "PcompList.UDL"
rstcomp.Open Source:="SELECT * FROM ""Sheet1$""", ActiveConnection:=cnncomp, CursorType:=adOpenStatic
If (rstcomp.BOF = True) Then
MsgBox "ERROR: no records in the database!"
GoTo CLEAN_UP
End If
rstcomp.MoveFirst
If (rstcomp.RecordCount = -1) Then
MsgBox "ERROR: record count = -1. Is the cursor type set incorrectly on the recordset open statement?"
End If
MSFlexGrid1.Rows = rstcomp.RecordCount + 1
MSFlexGrid1.Cols = rstcomp.Fields.Count
ReDim Components(0 To rstcomp.RecordCount - 1)
Call WriteGrid(0, 0, "wistron p/n")
Call WriteGrid(0, 1, "description")
Call WriteGrid(0, 2, "vendor")
MSFlexGrid1.ColWidth(0) = 1250
MSFlexGrid1.ColWidth(1) = 1250
MSFlexGrid1.ColWidth(2) = 1250
lngrow = 1
While (Not rstcomp.EOF)
For lngColumn = 0 To rstcomp.Fields.Count - 1
Call WriteGrid(lngrow, lngColumn, chknull(rstcomp.Fields(lngColumn).Value, ""))
If (lngColumn = 0) Then
Components(lngrow - 1).ProductName = chknull(rstcomp.Fields(lngColumn).Value, "")
lstProductName.AddItem chknull(rstcomp.Fields(lngColumn).Value, "")
Else
Components(lngrow - 1).Ingredient(lngColumn - 1) = chknull(rstcomp.Fields(lngColumn).Value, "")
End If
Next lngColumn
lngrow = lngrow + 1
rstcomp.MoveNext
Wend
CLEAN_UP:
If (Not (rstcomp Is Nothing)) Then ' see if recordset was set
If ((rstcomp.State And adStateOpen) = adStateOpen) Then ' see if recordset was opened
rstcomp.Close
End If
End If
If (Not (cnncomp Is Nothing)) Then
If ((cnncomp.State And adStateOpen) = adStateOpen) Then
cnncomp.Close
End If
End If
Set fso = Nothing
Set rstcomp = Nothing
Set cnncomp = Nothing
End Sub
Uploading A File
hello all i am using vb6. i need an easy way to upload a file to a web site, how ca i do it any help.. plz if u know can u provide a small example ?
Uploading File To FTP
Hey,
I'm a noob at codeing.
So im trying to upload a file to FTP and add random numbers to the name of it.
Does anybody have a code that will do this?
Uploading File Tp FTP
Westconn have given me a code to upload file to ftp. He also checked it from his pc.I also provided him my username and password. The file is uploading from his pc but there is an error at line "if not ret=1 rthen stop. I am uploading the project. Please check it.
Uploading File To Ftp
I am receiving error in the following code. This is a code to upload files to ftp server.
Code:
Private Sub Form_Load()
'Server Access type
Inet1.AccessType = icUseDefault
'Protocol to be used
Inet1.Protocol = icFTP
'Remote host name
Inet1.RemoteHost = "ftp.avi-bags.com"
'Server port number, usually its 21
Inet1.RemotePort = "21"
'Server password
Inet1.Password = "passsword"
'Server Username
Inet1.UserName = "username"
'Server session timeout
Inet1.RequestTimeout = "60"
End Sub
Private Sub Command1_Click()
'Uploading file to server
'PUT method is a command in FTP to upload file to a server
Inet1.Execute , "PUT ""c:vivek.txt""" & "vivek.txt"
MsgBox Inet1.ResponseInfo
End Sub
The error is "Unable to connect to remote host". I have also used ftp://avi-bags.com. But i am getting the same error.
FIle Uploading
hi,
ive been trying to find tutorials of using VB / Asp to create a file uploading system which is preferably in an active X control.
does nay1 know of any tutorials / examples??
many thanks.
Uploading A File
hello all i am using vb6
i am using this code to download a file
VB Code:
Private Declare Function URLDownloadToFile Lib "urlmon" _Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As _Long) As Long Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean Dim lngRetVal As Long lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0) If lngRetVal = 0 Then DownloadFile = TrueEnd Function Private Sub Form_Load() 'example by Matthew Gates (Puff0rz@hotmail.com) DownloadFile "http://www.freewebs.com/ziad_jabbour/mytext.txt", "c:downfile.txt" End Sub
what code should i use in order to upload a file over the net
plz provide me with some information and if there is an easy way like this or should i use a control ( provide the control name ) and the cose that should i write
Uploading A File
We have customers that will use a program that I am currently working on to build complex orders. I have that order exporting from an access database to an xml file on the client machine. Now I need to get it to our servers and into the order databases.
I was thinking of using FTP to our servers and then processing it somehow (any suggestions?) or sending it via email to our exchange server and then having an event process the order when it arrives. Any suggestions? How would you recommend doing it? Feel free to suggest another method.
Thanks!
File Uploading
In my Vb project , I need to upload a mdb file from given location in Local machine to web.
how it can be done in VB. If any one Know ,send reply immediately, it is urgent Plz
With thanks
Sav2p1y
File Uploading Using ASP!Help!!!
Hi,
I am currently working on a web site which allows users to submit images over the internet. I have to use ASP along with SQL Server.
I understand that a component needs to be created which is going to reside on the server and that component has to be called in ASP file. I need some help with builiding that component.
As of now I don't have a clue what I need to do to allow a user to upload an image so that it gets stored in the database.
I would really appreciate it if someone could help me out.
Please somebody help me!!
Thank you
File Uploading!! Somebody Help Me PLEASE!!
Hi,
I am currently working on a web site which allows users to submit images over the internet. I have to use ASP along with SQL Server.
I understand that a component needs to be created which is going to reside on the server and that component has to be called in ASP file. I need some help with builiding that component.
As of now I don't have a clue what I need to do to allow a user to upload an image so that it gets stored in the database.
I would really appreciate it if someone could help me out.
Please somebody help me!!
Thank you
FIle Uploading Using VB
Hi Genies
I am very new to VB. I would like to upload the file from one server to another using VB and HTTP. Is that possible ?
How can i achieve this ? Please direct me to some useful links.
Thanks
Shan
Automating File Uploading
Hi,
One good use of visual basic is to automate various acts on the web.
However, there is one element I cannot automate. The file element. The sort of element we use to upload files to the web.
How can I automate that?
Uploading File To Server
Hello. I need some code. What is the code for a client and server to upload file to server and then run the file using the client? Thank you in advance!
File Uploading Query
hi,
I have prepared one application in which i have to upload a picture and save it in database. Later when i want to view that picture i will call it from database and the picture should be visible in the picture box area defined by me.
Now for uploading the photograph i have written this code
visual basic code:
Private Sub cmdChUpdPhotograph_Click()
Dim mPhotopath as String
cdlgPhotograph.Filter = "Bitmap Files (*.bmp)|*.bmp|JPEG Files (*.jpg)|*.jpg"
cdlgPhotograph.ShowOpen
txtPhotograph.Picture = LoadPicture(cdlgPhotograph.FileName)
mPhotoPath = cdlgPhotograph.FileName
End Sub
For viewing i have wriiten this code
visual basic code:
Private Sub CmdOpen_Click()
On Error GoTo Hell
Dim rsCDetails As ADODB.Recordset
Dim CDetailQuery As String
CDetailQuery = "SELECT * FROM client_profile WHERE serialno = '" & lvwclientprofiles.SelectedItem.Text & "'"
Set rsCDetails = OpenRecordSet(CDetailQuery)
With frmClientProfile
.txtPhotograph.Picture = rsCDetails(9)
End With
Exit Sub
Hell:
MsgBox "Description: " & Err.Description & vbCrLf & _
"Number: " & Err.Number, vbOKOnly + vbInformation, "Error - Called from " & Me.Name & " Sub Form_Load"
End Sub
Now is the correct way of uploading and viewing the a picture. I am a little confused.
Guys please guide me through this
regards,
kaushik
Uploading An Xml File To A Website
Hi Guys,
can we able to upload a file to a website using wininet? I know that we can do this ftp but i need this using HTTP only. I was also able to post a string to a website but now I need to post an xml file(not only string but also with file name) to a website. How would i do that? Any kind of input is appreciated.
DilSe..
Uploading A File To A Server
I have a document (MS WORD) that has to be sent to a web server. How can i send this doc to my web server using VB .
I tried getting a file from any server page using the "Internet transfer control"
. Can i use "Internet controls" and wppost function to post my file back to the server, if so kindly help me to do.
Uploading Db File Automatically
Is there code that i could use that would automatically upload a database file (db1.mdb) to my fortunecity web server?? would i need to write code for FTP upload??
Uploading A File After Editing
If i download an excel/word or other document via a link through a web page and the document then fires up the respective application which the user edits it and then wants the document saved back to another url. does anyone have any code that can do that. Basically after the document (eg. excel) is changed then the Save dialog box needs to be able to save to a url on the web server. I already have the file upload/download component. My file is being saved as a blob in the database and has a unique identifier to distinguish it which is used during the download. Can any one help.
How Does File Uploading Work?
I'm designing my own Web Server control and I haven't been able to figure out exactly how it works. If I put a upload textbox on the page and the client uploads a file, all that is returned is the path of the file they want to upload. How do I actually get the contents. Remember I'm doing this through pure VB and html, not asp.
File Uploading/downloading
Hi All,
I want to know about the file uploading/downloading technique using with Visual Basic Component. Actually it's using in internet setting but I don't know how to do it. So please help me to solve the things!
Thanks,
Jason
Progress Bar On Uploading File
Trying to get the progress bar to work when I upload a file. Does any one have sample code on this. I'm using winnet.dll. I can upload the file ok but the progress bar does not work correctly.
Mike@spb
Uploading A File With WebClasses
Does anyone know how to upload a file using WebClasses?
I would like to include an input type="file" on my html template and be able to uplaod the file whilst processing the rest of the data.
I got the following code from somewhere that uses ReadBinary. I tried Request.ReadBinary before and after Request.Form commands, but get an error saying that you can't seem to use buth.
Is it possible to use ReadBianry and Form when reading a web page?
Has anyone got any code to uplaod a file using web classes?
Thank you
DS
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "UpLoadClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~ No CopyRight...use this code freely! ~
'~ ~
'~ by: Doug Dean, 1998 ~
'~ http://www.dougdean.com ~
'~ ddean@deltanet.com ~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
'----- DECLARE ASP OBJECTS
Private MyScriptingContext As ScriptingContext
Private MyRequest As Request
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
'----- CREATE ASP OBJECTS
Set MyScriptingContext = PassedScriptingContext
Set MyRequest = MyScriptingContext.Request
End Sub
Public Sub DoUpload()
'~~~~~ VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim varByteCount
Dim binArray() As Byte
Dim lngFileDataStart As Long
Dim lngFileDataEnd As Long
Dim strHeadData As String
Dim intFileTagStart As Integer
Dim strPathName As String
Dim intPathNameStart As String
Dim strFileName As String
Dim intFileNameStart As Integer
Dim intFileNameEnd As Integer
Dim strDelimeter As String
Dim intCount As Integer
Dim lngCount As Long
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ BYTE COUNT OF RAW FORM DATA ~~~~~~~~~~~~
varByteCount = MyRequest.TotalBytes
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ PLACE RAW DATA INTO BYTE ARRAY ~~~~~~~~~
ReDim binArray(varByteCount)
binArray = MyRequest.BinaryRead(varByteCount)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ PARSE HEADER DATA OF FIRST ELEMENT FROM BYTE ARRAY ~~~~~~~~~~~~~~~~~~~~~~
intCount = 0 'binArray is base zero
Do Until Right(strHeadData, 4) = vbCrLf & vbCrLf
strHeadData = strHeadData & Chr(binArray(intCount))
intCount = intCount + 1
Loop
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ PARSE FILE NAME ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'#1 Find the beginning of the file tag name (UploadFormName)
intFileTagStart = InStr(strHeadData, "UploadFormName")
'#2 Find the beginning of the FilePath ('filename=' plus 10 chars)
intPathNameStart = InStr(intFileTagStart, strHeadData, "filename=") + 10
'#3 Find the quote at the end of the file name sent by the user
intFileNameEnd = InStr(intFileTagStart, strHeadData, vbCrLf) - 1
' Check if no file name was sent (exit sub for this example)
If intPathNameStart = intFileNameEnd Then Exit Sub
'#4 Parse the path name
strPathName = Mid(strHeadData, intPathNameStart, intFileNameEnd - intPathNameStart)
'#5 Find the starting position the file name
For intCount = intFileNameEnd To intPathNameStart Step -1
If Mid(strHeadData, intCount, 1) = "" Then
intFileNameStart = intCount + 1
Exit For
End If
Next
'#6 Now parse the file name
strFileName = Mid(strHeadData, intFileNameStart, intFileNameEnd - intFileNameStart)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ PARSE DELIMETER FROM HEADER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strDelimeter = Left(strHeadData, InStr(strHeadData, vbCrLf) - 1)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ START AND END OF THE UPLOAD FILE DATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lngFileDataStart = InStr(intFileTagStart, strHeadData, vbCrLf & vbCrLf) + 4
lngFileDataEnd = CLng(varByteCount) - (Len(strDelimeter) + 6)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~ SAVE THE FILE DATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open App.Path & "" & strFileName For Binary Access Write As #1
' binArray is base zero...thus the decrementing
For lngCount = lngFileDataStart - 1 To lngFileDataEnd - 1
Put #1, , (binArray(lngCount))
Next
Close #1
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
End Sub
Help Required With File Uploading!!
Hi,
I am currently working on a web site which allows users to submit images over the internet. I have to use ASP along with SQL Server.
I understand that a component needs to be created which is going to reside on the server and that component has to be called in ASP file. I need some help with builiding that component.
As of now I don't have a clue what I need to do to allow a user to upload an image so that it gets stored in the database.
I would really appreciate it if someone could help me out.
Please somebody help me!!
Thank you
Uploading A File Automatically
Hi all
Can anybody tell me how to do this
I want to automatically Upload a particular file to my site say
"venkytvs.intranets.com"
The file is not in my network.
Can I achieve this in VB. Any ideas send me a mail or post in this site.
Thanks in advance
Venky
(venkytvs@hotmail.com)
Uploading File To Ftp Server
Hi there,
Can anybody tell me how to upload a file to a ftp suerver using any control (itmay be ITC or MSWinsock control). If code available then I will be very grateful to you.
Thanks in advance
Prashant J.
Uploading A Text File W/ HTTP In VB6.
Hi. I think this is a pretty easy thing to do, but I'm kind of going around in circles.
I have a VB6 app that prepares a flat file and then uploads it via FTP to our webserver. Works great, but more and more users are having trouble w/ firewall settings, etc. Some flat out can't do FTP transfers.
It seems to me that it would be better to go w/ an upload via HTTP. The server we are on does not allow the HTTP PUT command. Is there another way to do this? With POST?
Any help pointing me in the right direction would be great. Thanks.
Automatically Uploading A File To A Server
I'm new to server management. 1) What is the VB code to automatically upload a file, such as the results of a test, to a web server online? 2) What must I do and have on my web server to get this to work?
Here's some code I found that I think will do the trick. I want the user to click a Submit button so it submits the results of a quiz to the WEb server:
Will this work in 6.0? From: http://support.softartisans.com/docs...g_simplevb.htm
A Simple Visual Basic Upload
To use XFile from Visual Basic, add XFile to your list of VB references.
Exercise 3: A Simple Visual Basic Upload
1. Create a new, standard, Visual Basic project.
2. Open the Project menu, select References, and check "SAXFile 1.0 Type Library".
3. Create a command button on your form, name it cmdSendFiles, and give it an appropriate caption (such as, "Upload").
4. Enter the following code in the code section of your form.
Private Sub cmdSendFiles_Click()
'--- Create an instance of the XFRequest object, XFile's principal object
Set XFile = New XFRequest
'--- Set the Server to which you are uploading
XFile.Server = "localhost"
'--- Set the specific script to which you are uploading
XFile.ObjectName = "/SAXFileSamples/asp/post/onefile/formresp.asp"
'--- Set a file to upload
XFile.AddFile "C:oot.ini", "File1"
'--- Begin transferring the files
XFile.Start
'--- Destroy the XFRequest Object
Set XFile = Nothing
End Sub
5. Run the project and click on the upload button. Boot.ini will be uploaded to the local server.
Understanding the Script
* Set XFile = New XFRequest creates an instance of the XFRequest object. XFRequest is XFile's principal object. XFRequest sends the HTTP request (Get, Post, or Put) to the server.
* SAXFile.Server sets the domain to which the file will be posted. In this example we use "localhost." If we were posting through the Internet, we would use the format "www.domain.com."
* SAXFile.ObjectName specifies the exact page to which our request will be posted. In this case, it is formresp.asp, located in /saxfilesamples/asp/post/onefile. Formresp.asp uses SoftArtisans FileUp to process the upload.
* SAXFile.AddFile presets a file to upload. Addfile takes two parameters: the path and file name on the client, and an item name for reference to the file on the server.
* SAXFile.Start initiates the file transfer.
* Set XFile = Nothing destroys the project's instance of the XFRequest object. This prevents draining of your resources.
Randomly Generating File And Uploading
Hello, I have made a randomly generating file script, it basicly creates a text file with a random name (varible for it is sRandom). I then want to upload that file, but I am having trouble. For example:
VB Code:
Inet1.Execute , "PUT ""d: est.txt""" & "test.txt"
That works, but I'm trying to upload my new generated file (yes, it generates fine):
VB Code:
Inet1.Execute , "PUT ""D:"" & sRandom & "".txt""" & sRandom & ".txt"""
That does NOT work. Can anyone help? Thanks a ton
Uploading File From Client To Database
I'm working with ASP.NET but haven't gotten any responses over in there, so I'm going to post here. I want to upload a file from a client and send it to a database. Theres tons of code out there to upload from a browser to a folder on the web server, but nothing on uploading to a database. Does anyone have any sample code or know a site that does?
thanks,
eye
Uploading Data From CSV File To SQL Table
Hi all,
I am trying to figure out how to upload a CSV file into a SQL table.
I have found syntax (below) that gets the data into the table but it takes the entire file and puts it into one column.
CREATE TABLE #tempfile (line varchar(8000))
bulk INSERT #tempfile FROM 'c:master.txt'
SELECT * FROM #tempfile
The goal is to have a table already created that will have columns that match the headers in the text file. Then I want to upload the data to each column. So in the example below there would be 2 records and 6 columns in each record that is uploaded. The ultimate would be to read the column header in the file and place that into the correct column in the table. However, this is not necessary if I asure the file columns always match the table columns
@HDR:PDEFPERNO,TRCTCODE,TRTPCODE,SOTRREF,SOTRDATE,UNITCODE
0102,GL,A,,31.03.01,CSTR007
0103,GL,A,,31.03.01,CSTR007
Any idea how I can approach this? Seems like it would be so easy to do but I cannot find any info on how to do it. Note: I will be doing this from a VB application.
As always thanks for all ideas and input
Best regards,
MDA
Uploading Txt File To Geocities Account
hello
i know its alot to ask and it cant be simple, i dont even know if its possible.
but i want to make a vb application that saves the text i write into a txtbox to a .txt file (ive done this)
but i now want it to upload to my website on my geocities account.
can anyone help me with this?
any help is always appreciated.
thank you
Problem In Uploading File To Internet
hi,
i tried to upload my sample project (web design) created in frontpage to my web site but the message is this:
Quote:403 Forbidden
The requested URL '/' is a directory, and directory indexing is disabled on this server.
im using my iis, and my virtual directory is in ftp.
please help...
thanks,
sibasib
Regarding File Uploading To Remote Server
Hi,
In my Project I need to upload/Download files to/from remote server,
That i did it using third party OCX.It is working in our site
But when i test it by connecting to our clients site ,it is not working.
any one have any idea Why it is not working?
Regarding this If i need to tell U more details ,send me What I should tell u in detail ?
Thanks in advance
Sav2p1y
Uploading And Inserting A File Into A Database
I want to upload a file to the server and then store it in a table. I can find code for the upload but the help in Visual Studio states: The file is cached in its entirety in server memory.
WHen I upload a file do I have to save it in a directory first? Can I access it in memory and put it into a variable for insert?
[Request]File Uploading [Project M-SNiff]
Im gonna Kepp this short and snappy.
My Skill Level : Novice-Intermidiate
Required : Simple File uploading (Compatible with all types of files)
Project M-SNiff : Im not gonna say much i dont know the boundries of the forums rules if posting slighlty "Dodgy" things or requesting things that will help with them is prohibbited.
If you wanna speak then : Removed By Mod
(P.S First Of Hoepfully Many Posts)
(Hopefully some of those will be contributions :P)
Regards , Bulldog.
Uploading A File / Posting Data To PHP Script
Hi guys,
I am trying to post the following using winsock to my server
Code:
POST /somefile.php HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.11 [en]
Host: localhost
Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en;q=1.0
Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers
Content-Type: multipart/form-data; boundary=------------ZcpvRS7HNeFzxVsIlOwdUo
------------ZcpvRS7HNeFzxVsIlOwdUo
Content-Disposition: form-data; name="avf"; filename="C:TestingAvatarsDefaultfry_2.gif"
Content-Type: image/gif
GIF98a(THIS IS THE BINARY READ OF A .GIF FILE)
------------ZcpvRS7HNeFzxVsIlOwdUo
Content-Disposition: form-data; name="User"
admin
------------ZcpvRS7HNeFzxVsIlOwdUo
Content-Disposition: form-data; name="name"
Chat
------------ZcpvRS7HNeFzxVsIlOwdUo
Content-Disposition: form-data; name="file"
AvatarUpload
------------ZcpvRS7HNeFzxVsIlOwdUo
Now, am connecting, the data is being sent [i think], and im getting a reply from my server, only, the reply is not from the php script i want to post it to, its reply is from my index.php file..
The VB Code im using is:
VB Code:
Dim strFormData As String strFormData = strFormData & "POST /somefile.php HTTP/1.1" & vbCrLf strFormData = strFormData & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.11 [en]" & vbCrLf strFormData = strFormData & "Host: " & LCase(wsAvatarHost) & vbCrLf strFormData = strFormData & "Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1" & vbCrLf strFormData = strFormData & "Accept-Language: en;q=1.0" & vbCrLf strFormData = strFormData & "Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1" & vbCrLf strFormData = strFormData & "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0" & vbCrLf strFormData = strFormData & "Connection: Keep-Alive, TE" & vbCrLf strFormData = strFormData & "TE: deflate, gzip, chunked, identity, trailers" & vbCrLf strFormData = strFormData & "Content-Type: multipart/form-data; boundary=------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & "------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & "Content-Disposition: form-data; name=""avf""; filename=""" & sFilePath & """" & vbCrLf strFormData = strFormData & "Content-Type: image/gif" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & fGetFileContents(sFilePath) & vbCrLf strFormData = strFormData & "------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & "Content-Disposition: form-data; name=""User""" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & strUserName & vbCrLf strFormData = strFormData & "------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & "Content-Disposition: form-data; name=""name""" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & "Chat" & vbCrLf strFormData = strFormData & "------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & "Content-Disposition: form-data; name=""file""" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & "AvatarUpload" & vbCrLf strFormData = strFormData & "------------ZcpvRS7HNeFzxVsIlOwdUo" & vbCrLf strFormData = strFormData & vbCrLf strFormData = strFormData & vbCrLf Debug.Print strFormData With frmMainClient.wsAvatar .RemoteHost = wsAvatarHost .RemotePort = wsAvatarPort Call .Connect DoEvents Call .SendData(strFormData) End With
Now, i have got this thing working with a Inet control, but for some weird reason, the inet control's state doesnt always update, so i dont know when i can re-enable the controls / enable actions ETC....
Plus, if i can get this to work with a WS Control, its 1 less reference/ control i need to ship with my program.
does any one know the problem here please?
Inet1.execute PUT Uploading File Problem
I am using an Inet control for uploading files in my VB6 app.
But i have no luck cant get a file te bo uploaded to my ftp adres
It can get Connected, but when it gets to Transferring files status it keeps in that status and nothing gets uploaded.
Any ideas whats going wrong
My code:
'-First init the inet, i did use in the string my correct username and password!
' I did also try just the provider ftp://homeftp.tiscali.be and did'nt help me
tkftpAdres= "ftp://usernameassword@homeftp.tiscali.be"
inet1.protocol = icFTP '=2
inet1.URL= tkftpAdres
inet1.RequestTimeOut = 60
'-I did allso set my password ans username altgough is't already mentioned above
inet1.Username = tkMyUsername
inet1.Password = tkMyPassword
'I did also try following. For now i disabled this part
'Inet1.AccessType = icDirect ' or tried icUseDefault
'Inet1.RemotePort= 21
'Inet1.RemoteHost = tkftpAdres
'-Upload file 'Sometimes a / is used instead oh the space between the names
' I can use the tkftpAdres as a first parameter in the inet1.execute , didn't help me
'expl tksrcFolderFile = "C:MyFolderMyFile.txt" and tktargetFilename = "MyFile.txt"
inet1.execute ,"PUT " & tksrcFolderFile & " " & tktargetFilename
'I can use i wait loop
Do while inet1.Stillexecuting = true
do events
loop
'---
Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error Resume Next
Select Case State
Case icNone
Case icResolvingHost: Me.lblRESPONSE.Caption = "Resolving Host"
Case icHostResolved: Me.lblRESPONSE.Caption = "Host Resolved"
Case icConnecting: Me.lblRESPONSE.Caption = "Connecting..."
Case icConnected: Me.lblRESPONSE.Caption = "Connected"
Case icResponseReceived: Me.lblRESPONSE.Caption = "Transferring File..."
Case icDisconnecting: Me.lblRESPONSE.Caption = "Disconnecting..."
Case icDisconnected: Me.lblRESPONSE.Caption = "Disconnected"
Case icError: MsgBox "Error:" & Inet1.ResponseCode & " " & Inet1.ResponseInfo
Case icResponseCompleted: Me.lblRESPONSE.Caption = "Process Complete."
End Select
Me.lblRESPONSE.Refresh
Err.Clear
End Sub
Edited by - lvermeersch on 4/1/2005 7:41:36 AM
FTP Connection To Remote Server And Uploading File
Hello Dears Gurus
I am VB developer and I need ur assistance in the following context
FTP (Uploading and Downloading File)
I am working on different web sites and now I need to connection to my remote server upload some notepad file to my remote server, download some note pad file and delete some notepad file in my remote server I think I can do this through FTP but I donot now how I do this in my Visual basic Codes I need u help I shall be very thankful to u
Secoundly how can I came to know that conection of internet is connected or disconnected
Ok Bye
Tamoor
Uploading Image File To An Folder Thru VB Form
I need to know Using VB form how to Upload a image file to an folder(Example: Folder name is "imagefolder"). if folder(imagefolder) is not available it as to create folder(imagefolder) and upload the image file to the folder(imagefolder).
can any body send me the information or code on the same.
Uploading Any File Via FTP To A Ftp Server - INCLUDES WORKING SOURCE CODE
I'm just wondering is there any way to do this in VB without the extremely long API or extra modules or anything - like using components such as Winsock or Inet (I've heard it is possible, but maybe that's rubbish).
I haven't got a problem with API or extra modules. It's just that I'm going to need this for a college project which is going to be examined, and I'd rather go through the hassle (if it's worth the time) of learning how to use the control and then using it in my own project. I'd rather not use someone else's code since
1) I'm going to have to reference that in my coursework, which might make examiners go "oh, this person doesn't know real solid programming. He's just copied and pasted anything he could find off the internet. Even a baby can do that!"
2) I could just not reference that, but thats really wrong and they'd probably suspect with all the commenting like
VB Code:
'FTP Transfer via API'(c) John Smith 2005. You can freely distribute this code'Website: [url]http://www.planetsourcecode.com[/url]'Email: [email]johnsmith@someisp.com[/email]'...
If you could come up with something, then that would be absolutely brilliant. I've tried PlanetSourceCode already and have searched the forums. By the way, I am handing reps out
kregg
File Uploading To Ftp Server: Internet Transfer Control Vs CftpClient Class
I am develping an application which will upload the files to ftp server.
(My application will upload image files to ftp server)
What I found is that there are two ways to do this:
1. By using : Internet Transfer Control
2. By usging:CftpClient class/ ftpFiles and related classes
I got sample code on both of these.
But: "Which one is better and effcient. Which method should I use."
Please help and guide and if you can tell the difference between these two methods.
Please help and guide.
|