|
|
#1 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Winsock: HTTP File Upload
Introduction
One of the most useful extensions to the HTTP protocol, is the ability to use it to upload files. Although, compared to FTP it is somewhat limited, all that is required to make use of HTTP file uploads is access to a web browser. Transferring files using HTTP is generally safer than FTP as the data sent to the server can be carefully scrutinised before the commitment is made to store / use it. For this reason it is ideal in client/server applications which regularly need to transfer data over the Internet. The following application, demonstrates how to upload files to a web server using Visual Basic, with the help of the winsock control. In order to add the Winsock Control to your VB6 application, right click on the tool box, select components from the menu and check the box "Microsoft Winsock Control". This mimics what a web browser does when you upload a file to a site via a web form. A Bit about HTTP The Winsock control enables you to establish a connection to another computer using either TCP / UDP and transfer data over that connection. HTTP (Hypertext Transfer Protocol) is used to request and send data to web resources and it is up to the programmer to construct the HTTP request and parse the response. The file upload application uses a HTTP POST request to send the file in the form of a multi part HTTP request. This is explained fully in RFC 1867 Using the Demo Application The demo application allows you to enter a URL and choose the file which you wish to upload. You must give the file a name and an MIME type; a list of MIME types for particular file extensions can be found here. Pressing the upload button sends the HTTP request containing the data from the file which you have chosen. Like I mentioned earlier HTTP file uploads are useful in client / server applications. So, I have made a script which will take file uploads to demonstrate how the application works, it also has a web interface: http://adam.codedv.com/examples/post_dump.php The files which have been uploaded can be found here, it is clear that there is no conceivable difference between files uploaded via VB and via a web browser. The means in which the server gets the data is transparent.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#2 |
|
New Member
Join Date: Jun 05
Posts: 2
![]() |
Re: Winsock: HTTP File Upload
plz send to me the (post_dump.php) file to put it in my site and try it
send it to hanysabra@hotmail.com |
|
|
|
|
|
#3 | |
|
Super Moderator
Join Date: Aug 01
Location: Sterling Heights, Michigan
Posts: 54,096
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Quote:
Second, you should never, ever put your email address in any open forum post anywhere. It is very easy for spam bots to pick that up. If you wish to let one of our members know what your email address, please use our internal private messenging system. Thanks.
__________________
Please use [Code]your code goes in here[/Code] tags when posting code. When you have received an answer to your question, please mark it as resolved using the Thread Tools menu. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum. ![]() Creating A Wizard In VB.NET Modifications Required For VB6 Apps To Work On Vista Paging A Recordset What is wrong with using On Error Resume Next Good Article: Language Enhancements In Visual Basic 2010 IT professionals freelancer site. Register today to find coders, or offer your services for available freelance projects! Upgrading VB6 Code To VB.NET Microsoft MVP 2005/2006/2007/2008/2009/2010 Last edited by Hack; Jun 13th, 2005 at 12:03 PM. |
|
|
|
|
|
|
#4 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Everyone seems to want the source code for the PHP files. So, here they are.
The post_dump.php file simply loops through all the posted variables and files and displays information on them. It saves the files in another directory, so to use it you need to create two directories: uploaded_files uploaded_files/files post_dump.php PHP Code:
The uploaded_files.php file, displays or allows the user to download last 5 uploaded files. uploaded_files.php PHP Code:
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
Last edited by visualAd; Jun 13th, 2005 at 09:22 AM. |
|
|
|
|
|
#5 |
|
New Member
Join Date: Jun 05
Posts: 2
![]() |
Re: Winsock: HTTP File Upload
thank you too match and many thanks to this great fourm
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Jun 05
Posts: 4
![]() |
This programs are working some how okey, but when I try to use the documents (JPG pictures or any other) online (meaning on a web page or by direct access to it from a web folder,) It just doesn't work. I can not use the files online. Why? Is there any whay to do it, or fix it. I have being trying all kinds of things: change mime type, etc. But still nothing. I will apreciate any help.
Last edited by joechez; Jun 26th, 2005 at 09:52 AM. |
|
|
|
|
|
#7 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Can you clarify what the problem is? - Is it with the server scripts or the example program? Do you get any error messages or is the file just messed up?
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#8 |
|
New Member
Join Date: Jun 05
Posts: 4
![]() |
Re: Winsock: HTTP File Upload
I just want to use the uploaded pictures on my website, but they just don't work. If I upload manually using ftp they work just fine. But if I use the script, they don't. Then using the script, I uploaded some pictures (to try out) and downloaded them using ftp. Then uploaded them againg using ftp, and they didn't show up. So, something happend with the pictures using the script. I try other documents also with the same results.
|
|
|
|
|
|
#9 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
What errors are you getting? And have you created the correct directories to place the uploaded files in?
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#10 |
|
New Member
Join Date: Jun 05
Posts: 4
![]() |
Re: Winsock: HTTP File Upload
Yes! I have created the needed folders. As I said the script is working. I can upload and download files. But the files get corrupted or something because after doing an upload, they just don't work on regular web pages. I think the attributes of the files are changing or something.
|
|
|
|
|
|
#11 |
|
New Member
Join Date: Jun 05
Posts: 4
![]() |
Re: Winsock: HTTP File Upload
Yeep! The files work okey just changing the attributes to public read and to group read. Still looking forward to transffer variables at the same time using VB6.
|
|
|
|
|
|
#12 |
|
New Member
Join Date: Apr 05
Posts: 6
![]() |
Re: Winsock: HTTP File Upload
Hi,
The above example wont work with https site.Pls let me know the solution. Thanks Harish |
|
|
|
|
|
#13 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
HTTPs is HTTP tunneled through SSL. Unfortunatly this is vastly more complicated than a standard unencrypted HTTP connection and somthing which I haven't got the time or the knowledge to do at the moment.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#14 |
|
New Member
Join Date: Dec 05
Posts: 1
![]() |
Re: Winsock: HTTP File Upload
Hi All,
Even i am struggling with uploading files for https sites using vb 6.0. If anybody gets the solution don't forget to post it here..Also i am looking for this solution very urgently...so pls pls post it asap. Thanks in advanc svhk |
|
|
|
|
|
#15 |
|
New Member
Join Date: Dec 05
Posts: 1
![]() |
Re: Winsock: HTTP File Upload
Hi everyone,
The PHP and VB6 code posted here works really well. I was just wondering if it would be possible to generalize it to do what I would call "custom folders" (on the server). I would like to be able to upload just one licence file to a few dozen different folders (one per client). The version of the file is different for each folder. It would nice to be able to put a loop around the VB6 upload code to make this happen. But I don't know enough about the methodology used in the current PHP and VB6 code to do this. Any suggestions would be most welcome. Regards, Leigh |
|
|
|
|
|
#16 |
|
New Member
Join Date: Apr 06
Posts: 1
![]() |
Re: Winsock: HTTP File Upload
QUESTION:
I am connected to Internet Via Proxy. How can I make this sample work? If I have a direct connection, everything works well. Through proxy, I am getting this error: 'Valid name, no data record of requested type' (Code 11004) Need advice.. Thank you all. |
|
|
|
|
|
#17 |
|
New Member
Join Date: May 06
Posts: 2
![]() |
Re: Winsock: HTTP File Upload
anyone here can upload jpg, doc, zip... by this program? I have tried many time and can't success...
But I found that there are no problem when uploading plain text file(txt). |
|
|
|
|
|
#18 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
It works fine for me. Do you get any errors? And are you sending the right MIME type?
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
Last edited by visualAd; May 7th, 2006 at 09:44 AM. |
|
|
|
|
|
#19 |
|
New Member
Join Date: May 06
Posts: 2
![]() |
Re: Winsock: HTTP File Upload
Thank for your reply and your great program first!!
After many times of try and error, I found that it can upload jpg under ENGLISH WinXP, but not in CHINESE WinXP. for CHINESE WinXP: There are no error when uploading jpg file, but when I try to download the jpg file from server, I found that the content of jpg is changed and it can't be opened again. May be it is becasue of the encoding problems? |
|
|
|
|
|
#20 |
|
New Member
Join Date: Jul 06
Location: San Salvador, El Salvador
Posts: 2
![]() |
Hi!, in first place let me thank you for share your code visualAd, second a few questions about it:
1)Could your code work with "multipart/form-data" header type? 2)Wich is the max size of the file that can effectively be send?, despiting the servers limitations. 3)How necessary is to do it with winsock.ocx?, it's difficult to do it through winsocks APIs?, does need winsock.ocx be packed along the aplication? 4)Could your code be reproducible with Wininet APIs? Thanks in advance. Glad to see that someone is sharing this kind of hard to find but high usable code. |
|
|
|
|
|
#21 | ||||
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Quote:
Quote:
Quote:
Winsock is included by default from windows 98+, so I would imagain you'd be quite safe. Quote:
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
||||
|
|
|
|
|
#22 | ||||
|
New Member
Join Date: Jul 06
Location: San Salvador, El Salvador
Posts: 2
![]() |
Re: Winsock: HTTP File Upload
Quote:
VB Code:
Later I see this: VB Code:
Quote:
Quote:
Quote:
|
||||
|
|
|
|
|
#23 |
|
New Member
Join Date: Jul 06
Posts: 1
![]() |
What if
What if I need to send more data in the form. Like two other input type="text" in the same form to autenticate the user that is sending the file??? Please help.
|
|
|
|
|
|
#24 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
You need to encode each variable as a part in the HTTP request. I.e:
Code:
--BOUNDARY Content-Disposition: form-data; name="var1" value1 --BOUNDARY Content-Disposition: form-data; name="var2" value2 --BOUNDARY Content-Disposition: form-data; name="file"; filename="file.txt" Content-Type: text/plain File text. --BOUNDARY--
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#25 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
I'll have a look at modifying the app to include other variables, it is easy enough to modify by yourself however. Also, have a look at the demo app for sending GET/POST HTTP requests.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#26 |
|
Junior Member
Join Date: Jun 06
Location: Kedah, Malaysia
Posts: 28
![]() |
Re: Winsock: HTTP File Upload
pls somebody..
why did i get this error msg.. HTTP/1.1 401 Access Denied Server: Microsoft-IIS/5.1 Date: Mon, 19 Jun 2006 18:00:32 GMT WWW-Authenticate: Negotiate WWW-Authenticate: NTLM Content-Length: 24 Content-Type: text/html Error: Access is Denied. |
|
|
|
|
|
#27 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
You need to authenticate yourself using NTLM (Microsoft Windows NT LAN Manager) authentication. It is possible to do this in VB but involves a lot of byte shifting and code.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#28 |
|
Junior Member
Join Date: Jun 06
Location: Kedah, Malaysia
Posts: 28
![]() |
Re: Winsock: HTTP File Upload
thanks 4 ur reply visualAd,
pls gimme more detail, how to do so..in policy setting? im using winxp as webserver(just for development).. im going to host my webserver at hosting company... what do i need to tell them to do? ill buy u a pasta then..hehe..
|
|
|
|
|
|
#29 | |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Quote:
Like I say. I have never written an NTLM authenticator in VB and I do not plan to either. That doesn't mean the its not possible, just that its a complex and time consuming task. If you want to do it yourself here is a detailed specification. http://curl.haxx.se/rfc/ntlm.html
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
|
#30 |
|
Junior Member
Join Date: Jun 06
Location: Kedah, Malaysia
Posts: 28
![]() |
Re: Winsock: HTTP File Upload
thanks a lot visualAd,
it sound quite hard for that coding... me either didnt plan to do so...hehe... im better choose another solution... im planning to update my sql server directly from my vb local client instead of upload the file then update at the server. which one is better in terms of reliability? |
|
|
|
|
|
#31 |
|
New Member
Join Date: Aug 06
Posts: 1
![]() |
Re: Winsock: HTTP File Upload
Hi All,
problem look at the picture |
|
|
|
|
|
#32 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
That is an HTTP error. It means you don't have permission to access the file.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#33 |
|
New Member
Join Date: Jun 06
Posts: 4
![]() |
Re: Winsock: HTTP File Upload
First of all, I want to thank you for the code. I've been using it for a while and it works great.
Now for my question. Has anyone used a progress bar with the winsock control for uploading files? I'm new to progress bars and want to add one to this code for my program users. Any suggestions, refrences or code would be greatly appreciated. Thanks in advance |
|
|
|
|
|
#34 |
|
New Member
Join Date: Nov 06
Posts: 1
![]() |
Re: Winsock: HTTP File Upload
This is fantastic.
Has anyone created an ASP version of the PHP code ? Thank-you. Juls |
|
|
|
|
|
#35 |
|
PoorPoster
Join Date: Oct 05
Location: in an island
Posts: 2,658
![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Hey Visual,
any idea how to modify this code for imagesack.us or similar sites ? These sites redirects to another page (which contains the new links) after uploading. I tried to upload google2.gif to imagesack usin your code and got this: Upload URL: Code:
tried these two: http://www.imageshack.us/transload.php http://imageshack.us/ie.php Code:
POST /transload.php? HTTP/1.0 Host: www.imageshack.us Content-Type: multipart/form-data, boundary=tf63uHQ4SWyMnYsVco1QyHEi5qlB08uv Content-Length: 1739 --tf63uHQ4SWyMnYsVco1QyHEi5qlB08uv Content-Disposition: form-data; name="file"; filename="google2.gif" Content-Type: application/octet-stream GIF89a4 Code:
HTTP/1.0 302 Found Connection: close X-Powered-By: PHP/4.4.2 location: http://www.imageshack.us/ Content-type: text/html Content-Length: 0 Date: Mon, 18 Dec 2006 19:33:19 GMT Server: lighttpd/1.4.8 2. What changes need to be made for registered users ? (Imagesack doesn't allow image deletion for unregistered users)
__________________
Usefull VBF Threads/Posts I Found "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner Last edited by iPrank; Dec 18th, 2006 at 01:55 PM. |
|
|
|
|
|
#36 |
|
Frenzied Member
Join Date: Dec 05
Location: Zeta Reticuli Distro:Ubuntu Fiesty
Posts: 1,162
![]() ![]() |
Re: Winsock: HTTP File Upload
Try the one from vbip.com.It detects redirects.I'm not sure though if this is what you asked for:
http://www.vbip.com/winsock/winsock_http_07_01.asp
__________________
__________________ ________________0ооо___ ___ооо0________(___)____ __(___)_________) _/_____ ___\_ (_________(_/______ ____\_)_________________ |
|
|
|
|
|
#37 |
|
PoorPoster
Join Date: Oct 05
Location: in an island
Posts: 2,658
![]() ![]() ![]() ![]() ![]() |
Re: Winsock: HTTP File Upload
Sorry for the confusion. I shouldn't have said 'redirection'.
I tried to mean, when you finish uploading files in imagesack (or YahooMail) they opens a new page that contains URL of the newly uploaded file. (In case of YMail, it is the 'finish attatching file and continue to message' page.) Getting the HTML of this 'uploading-finished-and-here-is-your-URL' page is necessary. Without it I can't get URL of my own images. When I tried to mix Visual's and VBIP's code, I got this as 'new URL'. Code:
http://www.imageshack.us/2 Found [I need this 'cause I want to make a smily collection app like the one Static was making, but want to store the images in ImageSack for easier sharing]
__________________
Usefull VBF Threads/Posts I Found "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner Last edited by iPrank; Dec 18th, 2006 at 10:53 PM. |
|
|
|
|
|
#38 |
|
Frenzied Member
Join Date: Dec 05
Location: Zeta Reticuli Distro:Ubuntu Fiesty
Posts: 1,162
![]() ![]() |
Re: Winsock: HTTP File Upload
You need to have cookies enabled for that and also it returns a 302(temporarily moved) which means it is not handling the redirects(not exactly redirects but kinda) properly.
I don't how far i can help you out but i can suggest these: 1.Get live http headers extension for Firefox.: http://livehttpheaders.mozdev.org/ 2.Check out the way things work in the background: Here is my output: Code:
http://reg.imageshack.us/setlogin.ph...051795891XXXXX GET /setlogin.php?login=eef5cc5e36b051795891XXXXX HTTP/1.1 Host: reg.imageshack.us User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 302 Found Connection: close X-Powered-By: PHP/5.1.2 Location: http://dev.imageshack.us/setlogin.ph...xxxxxxxxx&xml= Content-Type: text/html Content-Length: 0 Date: Tue, 19 Dec 2006 07:13:18 GMT Server: lighttpd/1.4.8 ---------------------------------------------------------- http://dev.imageshack.us/setlogin.ph...xxxxxxxxx&xml= GET /setlogin.php?login=eef5cc5e36b051795891xxxxxxxxx&xml= HTTP/1.1 Host: dev.imageshack.us User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 302 Found Date: Tue, 19 Dec 2006 07:09:08 GMT Server: Apache/2.0.52 (CentOS) X-Powered-By: PHP/4.3.9 Set-Cookie: myid=3733953; expires=Fri, 14-Dec-2007 07:09:08 GMT; path=/; domain=.imageshack.us Set-Cookie: myimages=eef5cc5e36b051795891xxxxxxf3; expires=Fri, 14-Dec-2007 07:09:08 GMT; path=/; domain=.imageshack.us Location: http://reg.imageshack.us/v_images.php Content-Length: 0 Connection: close Content-Type: text/html; charset=UTF-8 ---------------------------------------------------------- http://reg.imageshack.us/v_images.php GET /v_images.php HTTP/1.1 Host: reg.imageshack.us User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: myid=3733953; myimages=eef5cc5e36b051795891xxxxx90f3 HTTP/1.x 200 OK Connection: close X-Powered-By: PHP/5.1.2 Set-Cookie: myimages=eef5cc5e36b051795891xxxxxxxx; expires=Fri, 14-Dec-2007 07:13:21 GMT; domain=.imageshack.us Content-Type: text/html Date: Tue, 19 Dec 2006 07:13:21 GMT Server: lighttpd/1.4.8 Transfer-Encoding: chunked ---------------------------------------------------------- http://support.microsoft.com/kb/q196062/ I suggest you use inet control for this or the class module from vbip.com . If needed try the user agent extension and modify headers extension to play around with headers.
__________________
__________________ ________________0ооо___ ___ооо0________(___)____ __(___)_________) _/_____ ___\_ (_________(_/______ ____\_)_________________ |
|
|
|
|
|
#39 |
|
Junior Member
Join Date: Feb 07
Posts: 16
![]() |
Re: Winsock: HTTP File Upload
Thanks for such a wonderful script. How do I cite you as a credit for when I use it?
I got this error: HTTP/1.1 406 Not Acceptable Date: Thu, 08 Feb 2007 19:12:41 GMT Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>406 Not Acceptable</TITLE> </HEAD><BODY> <H1>Not Acceptable</H1> An appropriate representation of the requested resource /politicstestresults/post_dump.php could not be found on this server.<P> <HR> <ADDRESS>Apache/1.3.37 Server at www.kelceycoe.com Port 80</ADDRESS> </BODY></HTML> I've uploaded the files to my upload directory as shown, and chomodded the directory and php files as 777. Is that right or am I doing something way wrong? Thanks. Last edited by kelceycoe; Feb 8th, 2007 at 01:14 PM. |
|
|
|
|
|
#40 | |
|
New Member
Join Date: Aug 06
Location: Mumbai
Posts: 7
![]() |
Re: Winsock: HTTP File Upload
Guys,
Me trying to upload file using VB HTTP Post method. Can successfully upload the files when my client machine is English OS . However , the problem occurs when am trying to upload the files from Chinese OS. It seems that the file uploaded is getting corrupted and could not be opened in correct format. This is applicable for binary files. The text files could be uploaded successfully. I have tried setting content-type, charset,codepage etc properties to assemble the body. Can anyone help me ? Its urgent ....Hope to find some VB GURU in this group.HELP ! Thanks in advance, Ashish.0. Quote:
|
|
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|