Image Upload API

Developer Documentation v1.0.0

โ† Back to Uploader

๐Ÿ“š Overview

This API provides a simple interface for uploading images to cloud storage. It supports both direct file uploads and URL-based uploads, returning a direct link to the hosted image.

โœจ Features

  • โ€ข File & URL uploads
  • โ€ข Multiple image formats
  • โ€ข JSON responses
  • โ€ข Automatic file naming

๐Ÿ–ผ๏ธ Supported Formats

  • โ€ข JPEG/JPG
  • โ€ข PNG, GIF, WebP
  • โ€ข TIFF, BMP

๐Ÿš€ Getting Started

BASE URL https://img.geekhirusha.com/upload.php

Replace yourdomain.com with your actual domain name.

Quick Test

Test the API with a simple cURL command:

curl -X POST https://img.geekhirusha.com/upload.php \
  -F "image=@/path/to/image.jpg"

๐Ÿ”Œ API Endpoints

Method 1: File Upload

POST /upload.php

Parameters

Parameter Type Required Description
image File Yes Image file to upload

Method 2: URL Upload

POST /upload.php

Parameters

Parameter Type Required Description
imageUrl String Yes Valid URL to image

๐Ÿ“ค Response Format

Success Response

{
  "success": true,
  "url": "https://i.ibb.co/xxxxx/GHDev-2025-12-14_10-30-45.jpg"
}

Error Response

{
  "success": false,
  "error": "Invalid file type"
}

๐Ÿ’ป Code Examples

JavaScript (Fetch API)

// File Upload
const formData = new FormData();
formData.append('image', fileInput.files[0]);

fetch('https://img.geekhirusha.com/upload.php', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    console.log('Image URL:', data.url);
  } else {
    console.error('Error:', data.error);
  }
})
.catch(error => console.error('Network error:', error));

// URL Upload
const formData2 = new FormData();
formData2.append('imageUrl', 'https://example.com/image.jpg');

fetch('https://img.geekhirusha.com/upload.php', {
  method: 'POST',
  body: formData2
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    console.log('Image URL:', data.url);
  }
});

Python (Requests)

import requests

# File Upload
url = "https://img.geekhirusha.com/upload.php"
files = {'image': open('image.jpg', 'rb')}
response = requests.post(url, files=files)
data = response.json()

if data['success']:
    print(f"Image URL: {data['url']}")
else:
    print(f"Error: {data['error']}")

# URL Upload
data = {'imageUrl': 'https://example.com/image.jpg'}
response = requests.post(url, data=data)
result = response.json()

if result['success']:
    print(f"Image URL: {result['url']}")

PHP (cURL)

<?php
// File Upload
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://img.geekhirusha.com/upload.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'image' => new CURLFile('/path/to/image.jpg')
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

if ($data['success']) {
    echo "Image URL: " . $data['url'];
} else {
    echo "Error: " . $data['error'];
}

// URL Upload
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://img.geekhirusha.com/upload.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'imageUrl' => 'https://example.com/image.jpg'
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>

cURL

# File Upload
curl -X POST https://img.geekhirusha.com/upload.php \
  -F "image=@/path/to/image.jpg"

# URL Upload
curl -X POST https://img.geekhirusha.com/upload.php \
  -d "imageUrl=https://example.com/image.jpg"

โš ๏ธ Error Handling

Error Message Cause Solution
Invalid file type Unsupported format Use JPG, PNG, GIF, WebP, TIFF, or BMP
No file or URL provided Missing parameters Include 'image' file or 'imageUrl'
Server error Backend issue Try again later
Network error Connection failed Check internet connection

๐Ÿงช Testing the API

You can test the API directly from this page using the interactive form below:

Live API Tester

Developed by GeekHirusha Dev

API Documentation v1.0.0 | Last Updated: July 16, 2025