Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
Аз ползвам този клас за да качвам в prikachi.com за lxshotHunteR каза:Ето какво намерих.
http://www.phpclasses.org/browse/package/3753.html
С малко преработка ще стане муцка![]()
alex95_bg_2 каза:Аз ползвам този клас за да качвам в prikachi.com за lxshotHunteR каза:Ето какво намерих.
http://www.phpclasses.org/browse/package/3753.html
С малко преработка ще стане муцка![]()
Там се взима най-лесно линка после
<?php
/**************************************************************************************
Author: Abhishek Kumar Srivastava
Email: abhisheksrivastava@fastmail.fm
Purpose: The class is written for uploading file using curl
Liscense: GNU GPL
**************************************************************************************/
class CurlFileUploader {
var $filePath;
var $uploadURL;
var $formFileVariableName;
var $postParams = array();
/* Constructor for CurlFileUploader
* @param $filePath absolute path of file
* @param $uploadURL url where you want to upload file
* @param $formFileVariableName form field name to upload file
* @param $otherParams assosiative array of other params which you want to send as post
*/
function CurlFileUploader ($filePath, $uploadURL, $formFileVariableName, /* assosiative array */ $otherParams = false) {
$this->filePath = $filePath;
$this->uploadURL = $uploadURL;
if(is_array($otherParams) && $otherParams != false) {
foreach ($otherParams as $fieldName => $fieldValue) {
$this->postParams[$fieldName] = $fieldValue;
}
}
$this->postParams[$formFileVariableName] = "@".$filePath;
}
/*
* function to upload file
* if unable to upload file produce error and exit
* else upload file
*/
function UploadFile () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->uploadURL );
curl_setopt($ch, CURLOPT_POST, 1 );
print_r($this->postParams);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
print "<br>Unable to upload file.";
exit();
}
curl_close($ch);
exit();
}
}
?>
<?php
/**************************************************************************************
Author: Abhishek Kumar Srivastava
Email: abhisheksrivastava@fastmail.fm
Purpose: The class is written for uploading file using curl
Liscense: GNU GPL
**************************************************************************************/
class CurlFileUploader {
var $filePath;
var $uploadURL;
var $formFileVariableName;
var $postParams = array();
/* Constructor for CurlFileUploader
* @param $filePath absolute path of file
* @param $uploadURL url where you want to upload file
* @param $formFileVariableName form field name to upload file
* @param $otherParams assosiative array of other params which you want to send as post
*/
function CurlFileUploader ($filePath, $uploadURL, $formFileVariableName, /* assosiative array */ $otherParams = false) {
$this->filePath = $filePath;
$this->uploadURL = $uploadURL;
if(is_array($otherParams) && $otherParams != false) {
foreach ($otherParams as $fieldName => $fieldValue) {
$this->postParams[$fieldName] = $fieldValue;
}
}
$this->postParams[$formFileVariableName] = "@".$filePath;
}
/*
* function to upload file
* if unable to upload file produce error and exit
* else upload file
*/
function UploadFile () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->uploadURL );
curl_setopt($ch, CURLOPT_POST, 1 );
#print_r($this->postParams);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
#print curl_error($ch);
print "<br>Unable to upload file.";
exit();
}
/*
ТУК ТВОЯ КОД
променливата $postResult ще ти върне страницата в която вече са качени картинките със всички линкове. Твоята задача е просто чрез explode примерно да отделиш това, което ти трябва от тази променлива :)
*/
curl_close($ch);
exit();
}
}
$objCurlFileUploader = new CurlFileUploader("D:\\My Pic\\my_pic.jpg", "http://pic-bg.net/upload.php",'userfile[]');
$objCurlFileUploader->UploadFile();
?>
<?php
error_reporting(E_ALL);
class CurlFileUploader {
var $filePath;
var $uploadURL;
var $formFileVariableName;
var $postParams = array();
/* Constructor for CurlFileUploader
* @param $filePath absolute path of file
* @param $uploadURL url where you want to upload file
* @param $formFileVariableName form field name to upload file
* @param $otherParams assosiative array of other params which you want to send as post
*/
function CurlFileUploader ($filePath, $uploadURL, $formFileVariableName, /* assosiative array */ $otherParams = false) {
$this->filePath = $filePath;
$this->uploadURL = $uploadURL;
if(is_array($otherParams) && $otherParams != false) {
foreach ($otherParams as $fieldName => $fieldValue) {
$this->postParams[$fieldName] = $fieldValue;
}
}
$this->postParams[$formFileVariableName] = "@".$filePath;
}
/*
* function to upload file
* if unable to upload file produce error and exit
* else upload file
*/
function UploadFile () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->uploadURL );
curl_setopt($ch, CURLOPT_POST, 1 );
//print_r($this->postParams);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
print "<br>Unable to upload file.";
exit();
}
curl_close($ch);
return $postResult;
//exit();
}
}
//print_r($_FILES['file1']);
$tmp = $_FILES['file1']['tmp_name'];
//if (@exif_imagetype($tmp) != IMAGETYPE_PNG) die("lxshot server: bad request");
if($_FILES['file1']['size'] > 2097152) die("lxshot server: image too big. sorry, max 2mb"); //2mb
$name = "shots/".md5(uniqid(rand(), true)).".png";
move_uploaded_file($_FILES['file1']['tmp_name'], $name);
$objCurlFileUploader = new CurlFileUploader($name, "http://www.prikachi.com/index.php",'userfile1', Array('tags' => 'lxshots', 'lock' => 'Checked', 'sent' => 'Качи'));
$out = $objCurlFileUploader->UploadFile();
preg_match('/value="http:\/\/prikachi.com\/files\/(.*).png"/i', $out, $ret);
$id = $ret[1];
echo "http://prikachi.com/files/$id.png\n";
unlink($name);
?>