Jump to content

franziss

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

franziss's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I found a solution from the internet, which uses curl with php, but it only works if the file to be uploaded is in the same location as the server. In the code below, the image I want to upload is from the client PC, c:\a.jpg, but it does not work. Anybody has any suggestion? Thanks! <?php // URL on which we have to post data $url = "http://home.com/processImage.php"; // File you want to upload/post $post_data['file'] = "@c:/a.jpg"; // Initialize cURL $ch = curl_init(); // Set URL on which you want to post the Form and/or data curl_setopt($ch, CURLOPT_URL, $url); // Data+Files to be posted curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); // Pass TRUE or 1 if you want to wait for and catch the response against the request made curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // For Debug mode; shows up any error encountered during the operation curl_setopt($ch, CURLOPT_VERBOSE, 1); // Execute the request $response = curl_exec($ch); // Just for debug: to see response echo $response; ?>
  2. I tried the following code in uploadImage.php $image = $_GET['image']; $handle = fopen($image, "rb"); but it doesn't work. Is it that fopen will try to locate the this image in the server and not the client PC? I am thinking of another way to do this: Call http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg" In uploadImage.php do Step 1. $image = $_GET['image']; Step 2. pass $image into a form in uploadImage.php Step 3. Call a javascript in uploadImage.php to submit this form Step 4. Image is uploaded to the server. Do you think this is feasible? Thank you.
  3. I need to upload an image using php and store the image as blob in mysql. I understand the standard way is to create a form for the user, let the user choose the image to upload, click submit. But I need to create a php, for example, uploadImage.php?image="c:\myPhoto.jpg" and when I type http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg" from a web browser in my pc, I can automatically upload myPhoto.jpg to the myhome.com server? Thank you for your kind help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.