Solved

File upload

Posted on 2001-09-17
5
224 Views
Last Modified: 2010-04-17
Hi!
I'ld need to know how my client app could upload files to a HTTP server through port 80.
Do you have any idea?
Thanks
/Xavier
0
Comment
Question by:folletxavier
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6488580
Port 80 is the normal HTTP port. You could use plain HTMl to do that, using the <input type=file> tag.

Regards,
CJ
0
 

Author Comment

by:folletxavier
ID: 6489742
Yes, that's right...
I've come a bit farther since yesterday;
I create a client form
<FORM NAME="oForm" ACTION="/scripts/cpshost.dll?PUBLISH?/scripts/repost.asp" ENCTYPE="multipart/form-data" METHOD="post">
<INPUT TYPE="file" NAME="oFile1">
...
</FORM>
Where cpshost.dll is a Microsoft server DLL that copies the file to disk(on the server).
The problem that is left is how to send this HTTP request by code?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 6489915
Because the main-functionality already exists using the html input type=text I suggest you do something with the WebBrowser control. It does not have to be visible to the user though. Once you have the control in memory, you can write just one simple form (as above in your post) to the webbrowser. Then you fill in the value of the input type=file using the reference to the webbrowser. Since all is ran on the client you can do that pretty easy. Then you use the javascript's submit function to submit the form to the server.

Some VB code (I have no idea which language you are using).

Create a reference to the Microsoft Internet Controls, and place the component on the form. Make sure it is invisible.

Private Sub Form_Load()
    Me.WebBrowser1.NavigateTo "about:blank"
End Sub

Private Sub WebBrowser1_DocumentComplete( ... )
    If webbrowser1.location="about:blank" then
       webbrowser1.document.write "yourhtmlcodehere"
       webbrowser1.document.close
       webbrowser1.document.oForm.oFile1.value="c:\myfile.txt"
       webbrowser1.document.oForm.submit
    End If
End Sub

Code has not been tested, but I hope the idea is clear :-/

Regards,
CJ
0
 

Author Comment

by:folletxavier
ID: 6489946
CJ_S:
Thanks for the very nice fix but using the webbrowser control is unfortunately not an option in my application... Inet or even better WINAPI are the only alternative I am given.
/Xavier
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 100 total points
ID: 6493211
Check out the following site with information about the inet control.

http://local.15seconds.com/issue/990408.htm
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question