Link to home
Start Free TrialLog in
Avatar of retinax
retinax

asked on

VB6 How to Upload Files thru HTTP

Hello,

This is in continuous from:

https://www.experts-exchange.com/questions/22729407/VB6-HowTo-POST-request-using-WinInit-APIs.html

Though that was asked by different developer.

I have similar situation but I am trying to upload images (jpg files), please tell me how to achieve that thru HTTP POST using WinINet.

Thanks a lot,
Zeeshan
Avatar of PaulHews
PaulHews
Flag of Canada image

Question, how are you receiving the files on the server?
Avatar of retinax
retinax

ASKER

In PHP as:

<?php
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {

   if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
  else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
?>

ASKER CERTIFIED SOLUTION
Avatar of PaulHews
PaulHews
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of retinax

ASKER

Thanks, will try that out today and let you know...