Results 1 to 18 of 18

Thread: VB6 Import an Image to Web

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    13

    VB6 Import an Image to Web

    Hello everybody today I'm wondering how can I import and image to web with dialogs. I'm trying to make an image uploader for my user's errors. My system take screen photo and save it app path after then i must upload it http://tinypic.com or something else... So I can see errors with an automation. Anyway you know I need to click "choose" button and select and image help me please.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    13

    Re: VB6 Import an Image to Web

    I don't need it. I must do it with tinypic or similar web site. Like click button open dialog click image etc.

  4. #4

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    13

    Re: VB6 Import an Image to Web

    Are you sure you understand me?

  6. #6

    Re: VB6 Import an Image to Web

    I think so. You are in VB6 and you want the ability to upload to TinyPic using a console that will ensure a complete experience is available to you. In the past when working in any type of post condition, not using the webbrowser control, you would use that stack model. Have I ever done the upload, no. FTP is nice in combo with a web server, but you are using TinyPic so if it's not FTP it's going to be a XMLHTTP object or whatever it is.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Import an Image to Web

    Actually you'd be exporting the image.

    First you need to capture the image. Since that is likely to get you a bulky bitmap, second you need to compress it to a more compact format such as PNG. Then third you need a host that supports some image uploading API.

    FTP is old and crusty and was never designed for automated use. Cheapo web hosting often supports that because old versions of PHP broke Apache so that WebDAV can't also be added in.

    So look for a host that supports WebDAV or some RESTful HTTP API for image uploads. Then you don't have to deal with old, balky, firewall-hostile FTP.


    Since the hosting is the major hurdle, start there. After that you only have a ton of programming concepts to learn and perfect. Basically, if you are asking this question you are already in far over your head. So don't expect to solve this overnight, there is no copy/paste solution.

    Trying to scrape a human-driven web application is likely to run afoul of the site's terms of use. TinyPic is an ad-supported site with terms prohibiting such use and I see no API offered by them either.

  8. #8

    Re: VB6 Import an Image to Web

    I was always under the impression that WebDAV was not advantageous to use for one reason or another. It ends up just being a connected experience between server and client that keeps itself updated, at least that's my impression of it. It's like filesystemwatcher on FTP.

    As for FTP being old. It is but I would say it's better than WebDAV and is a wonderful way to do things.

  9. #9
    gibra
    Guest

    Re: VB6 Import an Image to Web

    Currently I do:
    1) Shows a messagebox with the error to the user who can decide to send me an email with the appropriate button "Send to Support"
    if user decide to send
    3) capture the screen with API functions (the image is a bitmap)
    3) convert the BMP image to JPG
    4.1) I create a message with the attachment in the mailer of the user who has to tell me more information because the image alone does not always help to understand the context
    Alternatively:
    4.2) send an email with the attachment using the library vbSendMail.dll, using my email account.

  10. #10

    Re: VB6 Import an Image to Web

    Quote Originally Posted by gibra View Post
    Currently I do:
    1) Shows a messagebox with the error to the user who can decide to send me an email with the appropriate button "Send to Support"
    if user decide to send
    3) capture the screen with API functions (the image is a bitmap)
    3) convert the BMP image to JPG
    4.1) I create a message with the attachment in the mailer of the user who has to tell me more information because the image alone does not always help to understand the context
    Alternatively:
    4.2) send an email with the attachment using the library vbSendMail.dll, using my email account.
    So TinyPic uses email. That's wild, and I've even used some email stuff in VB6, nothing with attachments sadly.

  11. #11
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,871

    Re: VB6 Import an Image to Web

    I think you misunderstood Gibra.
    He states that the images are directly send to him using email to his email address, not using an external image hoster.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Import an Image to Web

    Quote Originally Posted by GeoFrias View Post
    I was always under the impression that WebDAV was not advantageous to use for one reason or another. It ends up just being a connected experience between server and client that keeps itself updated, at least that's my impression of it. It's like filesystemwatcher on FTP.

    As for FTP being old. It is but I would say it's better than WebDAV and is a wonderful way to do things.
    Your impression is wrong. All I can imagine is that you might be thinking of the Windows WebDAV Filesystem Redirector. That's not what I was suggesting.

    FTP is one hot mess of problems, avoid it like the plague. SMTP is almost as firewall-hostile as FTP.

    WebDAV was designed to get around the problems those ancient protocols have. More often today people design a custom RESTful API instead. These are quite proprietary so you may be faced with redeisgn more often.

    See [VB6] Push to Pushbullet Demo for an example.

  13. #13

    Re: VB6 Import an Image to Web

    Quote Originally Posted by dilettante View Post
    Your impression is wrong. All I can imagine is that you might be thinking of the Windows WebDAV Filesystem Redirector. That's not what I was suggesting.

    FTP is one hot mess of problems, avoid it like the plague. SMTP is almost as firewall-hostile as FTP.

    WebDAV was designed to get around the problems those ancient protocols have. More often today people design a custom RESTful API instead. These are quite proprietary so you may be faced with redeisgn more often.

    See [VB6] Push to Pushbullet Demo for an example.
    My impression is not wrong. Also, FTP is not what you say it is. I think the real problem here is that this is not about the question, and I'm OK with that. I remember VB6 having one control that was always a hot mess when it came to using it for HTTP stuff. It was not the TCP control... Whatever, I'm no longer using this forum.

    Have a nice day. And life, for that matter.

  14. #14
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: VB6 Import an Image to Web

    Interestingly enough I have never ran into any issues using FTP.
    I have been using command line FTP for years to upload files to my web server and while it doesn't offer much or anything really in the way of progress reporting it has always worked as expected. Never had any failures due to firewalls and such.

  15. #15
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Import an Image to Web

    Most software firewalls and residential firewalls with automatically recognize FTP when standard ports are used, and they'll use tricks to open the necessary secondary back-port. This doesn't work is the capability has been disabled or isn't supported, and it usually comes a cropper on most corporate firewalls unless they also permit such risky behavior.

    The alternative is to use the "PASV mode" extension to FTP. But not all FTP servers and clients support it, so it isn't always an option.

    The other headache is that FTP clients by specification are interactive and attended by a person. Attempts to automate FTP client activity can fail because of this. The server can send arbitrary messages that are supposed to be displayed to the user for action.

    FTP is a very poor choice all around. SMTP is almost worse in every way because of the different set of baggage it carries.


    But people can do what they want. We'll just have them back here soon enough crying for help that may not be possible.

  16. #16
    Addicted Member sergeos's Avatar
    Join Date
    Apr 2009
    Location
    Belarus
    Posts
    162

    Re: VB6 Import an Image to Web

    If i use XMLHTTP for uploading(downloading), Can I track the count of bytes sent using this component?
    The documentation describes the XHR generate events. And in javascript has examples:
    Code:
    var oReq = new XMLHttpRequest();
    
    oReq.addEventListener("progress", updateProgress, false);
    oReq.addEventListener("load", transferComplete, false);
    oReq.addEventListener("error", transferFailed, false);
    oReq.addEventListener("abort", transferCanceled, false);
    
    oReq.open();
    
    // ...
    
    // status of transmition from server to client(download)
    function updateProgress (oEvent) {
      if (oEvent.lengthComputable) {
        var percentComplete = oEvent.loaded / oEvent.total;
        // ...
      } else {
        // not possible calculate
      }
    }
    
    function transferComplete(evt) {
      alert("Download complete");
    }
    
    function transferFailed(evt) {
      alert("Download error");
    }
    
    function transferCanceled(evt) {
      alert("Download canceled by user");
    }
    Is there a way to do it in VB6.0?
    Because, when send the large file system still busy while XHR get .Status = 4

    Maybe can do it with WithEvents or subclassing or anything else...
    Ten Years After - 01 You Give Me Loving

  17. #17
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Import an Image to Web

    The WinHttpRequest object offers better event binding for VB6 use.

    MSXML2.XMLHTTP doesn't have events, only callbacks.

    The code you showed above is for the version of XMLHttpRequest embedded within newer versions of IE. You can't use those from a VB6 program.

    In any case, when you get READYSTATE_COMPLETE (4) the request has completed.

    The status property is something else entirely, the HTTP status code. A value of 4 isn't even supposed to be possible. See: status Property (IXMLHTTPRequest).

  18. #18
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Import an Image to Web

    http://tinypic.com/terms.php

    The following are examples of the kind of activity that is illegal or prohibited on the Site and through the use of the TinyPic Services. TinyPic reserves the right to investigate and take appropriate legal action against anyone who, in TinyPic's sole discretion, violates this provision, including without limitation, reporting you to law enforcement authorities. Prohibited activity includes, but is not limited to:

    ...

    8.24 any automated use of the system, such as, but not limited to, using scripts to send images or videos; ...

    So if you are trying to use TinyPic you are violating their terms of use. I already told you that earlier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width