kvarnerexpress 0 Report post Posted December 13, 2005 Does anyone know how to upload a file and form datato a server?What i want to do is allow a user to upload a file and form datato my php script so i can process it. So of course FTP would beno good.I can do this with the XMLHTTP control but it does not thread andit pretty lame. Surely you can do it with winsock or InetAny ideas?Source code would be greatly appreciated. Share this post Link to post Share on other sites
Inspiron 0 Report post Posted December 13, 2005 I'm not sure if this is what you are looking for..Check it out...http://www.vb-helper.com/howto_upload_files.htmlOtherwise use the FTP protocol method...http://www.vb-helper.com/howto_ftp.html Share this post Link to post Share on other sites
sinmin 0 Report post Posted February 13, 2006 There are have FTP to be transfer file. I never been hear that using http to trasmit file le... Share this post Link to post Share on other sites
masterio 0 Report post Posted September 5, 2006 (edited) Hi kvarnerexpress,I've same problem with you, and after googling for days i didnt found what i want. but the basic for upload file is by sending "Content-Type: multipart/form-data" header. I used INET(Mic. Internet Transfer Control SP4) control for this. I've named this control INETPOST.assuming the field name is "myfile" and the button name is "upload" for the upload form ' create sub for making upload postprivate sub upload_file() dim strPOST as string, Header as string Boundary as string, uagent as string dim Idboundary as string ' id boundary for the site, it may different uagent = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7" INETPOST.host = "somesite.com; Idboundary = "9876543210123" ' you can generate this number Boundary = String(27, "-") & Idboundary ' mutipart post need "-" sign Header = uagent & vbCrLf & "Content-Type: multipart/form-data; " & "boundary=" & Boundary strPOST = "--" & Boundary & vbCrLf & _ "Content-Disposition: form-data; name=""myfile""" & vbCrLf & vbCrLf & _ """ & EncodeBin & """ & vbCrLf & _ "--" & Boundary & vbCrLf & _ "Content-Disposition: form-data; name=""upload""" & vbCrLf & vbCrLf & _ "Upload File" & vbCrLf & _ "--" & Boundary & "--" & vbCrLf INETPOST.Execute "http://http://www.somesite.com/upload.php&%2334;, "POST", strPOST, Header ' Wait untill it finished Do Until BekasNET.StillExecuting = False: DoEvents: Loopend sub' function to encode binary fileFunction EncodeBin(SourceFile As String)Dim buf As String, File1 As IntegerFile1 = FreeFileOpen SourceFile For Binary Access Read As #File1 ' make buffer to storing file's content buf = Space(LOF(File1)) Get #File1, , bufClose #File1EncodeBin = bufEnd Function Hope's help!! Edited September 5, 2006 by masterio (see edit history) Share this post Link to post Share on other sites
adiaz01 0 Report post Posted October 14, 2007 Q: Does anyone know how to upload a file and form datato a server?Assumptions that I made by reading your question and comments.You have a server with PHP as a web script and you want to save a file from you users desktop/volume/share to the http server using an html form.if this is correct you have to go to http://www.tizag.com/phpT/fileupload.phpI think this is what you looking for you can save information from a form to a database and upload a file to a server using PHP.Hope this help!! Share this post Link to post Share on other sites